Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ivoted/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions ivoted/aie2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_

Expand Down Expand Up @@ -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")
Expand All @@ -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":
Expand All @@ -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)
with open(opts.output_file, "w") as f:
print(module, file=f)