Skip to content

Commit

Permalink
Try enabling run_on_npu2
Browse files Browse the repository at this point in the history
  • Loading branch information
jgmelber committed Oct 25, 2024
1 parent a576bd2 commit 83d7051
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
//
// RUN: make -f %S/Makefile clean
// RUN: make -f %S/Makefile device=npu2
// RUN: %run_on_npu make -f %S/Makefile run device=npu2 | FileCheck %s
// RUN: %run_on_npu2 make -f %S/Makefile run device=npu2 | FileCheck %s
// CHECK: Running...
// CHECK: PASS!
18 changes: 13 additions & 5 deletions programming_examples/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
llvm_config.with_environment("PYTHONPATH", os.path.join(config.aie_obj_root, "python"))

run_on_npu = "echo"
run_on_npu2 = "echo"
xrt_flags = ""

# Not using run_on_board anymore, need more specific per-platform commands
Expand Down Expand Up @@ -131,18 +132,25 @@
result = result.stdout.decode("utf-8").split("\n")
# Starting with Linux 6.8 the format is like "[0000:66:00.1] : RyzenAI-npu1"
# Starting with Linux 6.10 the format is like "|[0000:41:00.1] ||RyzenAI-npu1 |"
p = re.compile(r"[\|]?(\[.+:.+:.+\]).+(Phoenix|RyzenAI-(npu\d))")
p = re.compile(r"[\|]?(\[.+:.+:.+\]).+(Phoenix|RyzenAI-(npu1\d))")
p2 = re.compile(r"[\|]?(\[.+:.+:.+\]).+(Phoenix|RyzenAI-(npu4\d))")
for l in result:
m = p.match(l)
if not m:
m2 = p2.match(l)
if not m and not m2:
continue
print("Found Ryzen AI device:", m.group(1))
if len(m.groups()) == 3:
print("\tmodel:", m.group(3))
config.available_features.add("ryzen_ai")
run_on_npu = (
f"flock /tmp/npu.lock {config.aie_src_root}/utils/run_on_npu.sh"
)
if m:
run_on_npu = (
f"flock /tmp/npu.lock {config.aie_src_root}/utils/run_on_npu.sh"
)
if m2:
run_on_npu2 = (
f"flock /tmp/npu.lock {config.aie_src_root}/utils/run_on_npu.sh"
)
break
except:
print("Failed to run xrt-smi")
Expand Down

0 comments on commit 83d7051

Please sign in to comment.