diff --git a/ivoted/Makefile b/ivoted/Makefile index 193771d..b982c80 100644 --- a/ivoted/Makefile +++ b/ivoted/Makefile @@ -35,11 +35,11 @@ endif build/aie.mlir: $(srcdir)/$(aie_py_src) @mkdir -p $(@D) - python3 $< -d $(devicename) -i1s $(in1_size) -i2s $(in2_size) -os $(out_size) > $@ + python3 $< -d $(devicename) -i1s $(in1_size) -i2s $(in2_size) -os $(out_size) -of $@ build/aie_trace.mlir: $(srcdir)/$(aie_py_src) @mkdir -p $(@D) - python3 $< -d $(devicename) -i1s $(in1_size) -i2s $(in2_size) -os $(out_size) -t $(trace_size) > $@ + python3 $< -d $(devicename) -i1s $(in1_size) -i2s $(in2_size) -os $(out_size) -t $(trace_size) -of $@ build/final.xclbin: build/aie.mlir build/scale.o @mkdir -p $(@D) diff --git a/ivoted/aie2.py b/ivoted/aie2.py index 69edc86..6220f39 100644 --- a/ivoted/aie2.py +++ b/ivoted/aie2.py @@ -10,7 +10,6 @@ import sys from aie.iron import Kernel, ObjectFifo, Program, Runtime, Worker -from aie.iron.placers import SequentialPlacer from aie.iron.device import NPU1Col1, NPU2 from aie.iron.controlflow import range_ @@ -100,15 +99,15 @@ def core_fn(of_in, of_factor, of_out, scale_scalar): # Create the program from the device type and runtime my_program = Program(dev, rt) - + # Place components (assign them resources on the device) and generate an MLIR module - return my_program.resolve_program(SequentialPlacer()) + return my_program.resolve_program() # Parse module arguments -if len(sys.argv) < 5: +if len(sys.argv) < 6: raise ValueError( - "[ERROR] Need at least 4 arguments (dev, in1_size, in2_size, out_size)" + "[ERROR] Need at least 5 arguments (dev, in1_size, in2_size, out_size, output_file)" ) p = argparse.ArgumentParser() p.add_argument("-d", "--dev", required=True, dest="device", help="AIE Device") @@ -127,6 +126,9 @@ def core_fn(of_in, of_factor, of_out, scale_scalar): default=0, help="Trace buffer size", ) + +p.add_argument("-of", "--output-file", required=True, dest="output_file", help="The name of the file in which the generated MLIR mldule will be written to") + opts = p.parse_args(sys.argv[1:]) if opts.device == "npu": @@ -147,4 +149,5 @@ def core_fn(of_in, of_factor, of_out, scale_scalar): module = my_vector_scalar_mul(dev, in1_size, in2_size, out_size, trace_size) # Print the generated MLIR - DO NOT REMOVE -print(module) \ No newline at end of file +with open(opts.output_file, "w") as f: + print(module, file=f) \ No newline at end of file