Skip to content

Commit 5737615

Browse files
committed
Removing column_id
1 parent 6a1fc04 commit 5737615

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// (c) Copyright 2025 Advanced Micro Devices, Inc.
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
//
4-
// REQUIRES: ryzen_ai, peano
4+
// REQUIRES: ryzen_ai, peano
55
//
6-
// RUN: %run_on_npu python3 %S/vector_vector_add_placed.py --device=npu --column=0
6+
// RUN: %run_on_npu python3 %S/vector_vector_add_placed.py --device=npu
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// (c) Copyright 2025 Advanced Micro Devices, Inc.
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
//
4-
// REQUIRES: ryzen_ai, peano
4+
// REQUIRES: ryzen_ai, peano
55
//
6-
// RUN: %run_on_2npu python3 %S/vector_vector_add_placed.py --device=npu2 --column=0
6+
// RUN: %run_on_2npu python3 %S/vector_vector_add_placed.py --device=npu2

programming_examples/basic/vector_vector_add/vector_vector_add_placed.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@iron.jit
20-
def vector_vector_add(config, input0, input1, output):
20+
def vector_vector_add(input0, input1, output):
2121
if input0.shape != input1.shape:
2222
raise ValueError(
2323
f"Input shapes are not the equal ({input0.shape} != {input1.shape})."
@@ -48,16 +48,16 @@ def vector_vector_add(config, input0, input1, output):
4848

4949
buffer_depth = 2
5050

51-
@device(config["device"])
51+
@device(iron.get_current_device())
5252
def device_body():
5353
tensor_ty = np.ndarray[(num_elements,), np.dtype[dtype]]
5454
tile_ty = np.ndarray[(n,), np.dtype[dtype]]
5555

5656
# AIE Core Function declarations
5757

5858
# Tile declarations
59-
ShimTile = tile(config["column_id"], 0)
60-
ComputeTile2 = tile(config["column_id"], 2)
59+
ShimTile = tile(0, 0)
60+
ComputeTile2 = tile(0, 2)
6161

6262
# AIE-array data movement with object fifos
6363
of_in1 = object_fifo("in1", ShimTile, ComputeTile2, buffer_depth, tile_ty)
@@ -114,9 +114,6 @@ def main():
114114
default="npu",
115115
help="Target device",
116116
)
117-
parser.add_argument(
118-
"-c", "--column", type=int, default=0, help="Column index (default: 0)"
119-
)
120117
parser.add_argument(
121118
"-n",
122119
"--num-elements",
@@ -132,14 +129,11 @@ def main():
132129
input1 = iron.randint(0, 100, (args.num_elements,), dtype=np.int32, device="npu")
133130
output = iron.zeros_like(input0)
134131

132+
iron.set_current_device(device_map[args.device])
133+
135134
# JIT-compile the kernel then launches the kernel with the given arguments. Future calls
136135
# to the kernel will use the same compiled kernel and loaded code objects
137-
vector_vector_add(
138-
{"device": device_map[args.device], "column_id": args.column},
139-
input0,
140-
input1,
141-
output,
142-
)
136+
vector_vector_add(input0, input1, output)
143137

144138
# Check the correctness of the result
145139
e = np.equal(input0.numpy() + input1.numpy(), output.numpy())

0 commit comments

Comments
 (0)