Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jackl-xilinx and github-actions[bot] authored Apr 24, 2024
1 parent a793fc0 commit d6b829b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
9 changes: 5 additions & 4 deletions programming_guide/section-4/section-4a/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ int main(int argc, const char *argv[]) {
if (verbosity >= 1)
std::cout << "Running Kernel.\n";
auto start = std::chrono::high_resolution_clock::now();
auto run =
kernel(bo_instr, instr_v.size(), bo_inA, bo_inFactor, bo_outC);
auto run = kernel(bo_instr, instr_v.size(), bo_inA, bo_inFactor, bo_outC);
run.wait();
auto stop = std::chrono::high_resolution_clock::now();

Expand All @@ -137,11 +136,13 @@ int main(int argc, const char *argv[]) {
int32_t test = bufOut[i];
if (test != ref) {
if (verbosity >= 1)
std::cout << "Error in output " << test << " != " << ref << std::endl;
std::cout << "Error in output " << test << " != " << ref
<< std::endl;
errors++;
} else {
if (verbosity >= 1)
std::cout << "Correct output " << test << " == " << ref << std::endl;
std::cout << "Correct output " << test << " == " << ref
<< std::endl;
}
}
auto vstop = std::chrono::system_clock::now();
Expand Down
2 changes: 1 addition & 1 deletion programming_guide/section-4/section-4b/aie2.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def sequence(A, F, C):
ShimTile,
ddr_id=2,
size=trace_size,
offset=4096*4, # offset in bytes
offset=4096 * 4, # offset in bytes
)

npu_dma_memcpy_nd(metadata="out", bd_id=0, mem=C, sizes=[1, 1, 1, 4096])
Expand Down
17 changes: 9 additions & 8 deletions programming_guide/section-4/section-4b/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ int main(int argc, const char *argv[]) {
// set up the buffer objects
auto bo_instr = xrt::bo(device, instr_v.size() * sizeof(int),
XCL_BO_FLAGS_CACHEABLE, kernel.group_id(0));
auto bo_inA = xrt::bo(device, IN_SIZE,
XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2));
auto bo_inA =
xrt::bo(device, IN_SIZE, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2));
auto bo_inFactor = xrt::bo(device, 1 * sizeof(DATATYPE),
XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3));
auto bo_outC = xrt::bo(device, OUT_SIZE,
XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4));
auto bo_outC =
xrt::bo(device, OUT_SIZE, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4));

if (verbosity >= 1)
std::cout << "Writing data into buffer objects.\n";
Expand Down Expand Up @@ -115,8 +115,7 @@ int main(int argc, const char *argv[]) {
if (verbosity >= 1)
std::cout << "Running Kernel.\n";
auto start = std::chrono::high_resolution_clock::now();
auto run =
kernel(bo_instr, instr_v.size(), bo_inA, bo_inFactor, bo_outC);
auto run = kernel(bo_instr, instr_v.size(), bo_inA, bo_inFactor, bo_outC);
run.wait();
auto stop = std::chrono::high_resolution_clock::now();

Expand All @@ -140,11 +139,13 @@ int main(int argc, const char *argv[]) {
int32_t test = bufOut[i];
if (test != ref) {
if (verbosity >= 1)
std::cout << "Error in output " << test << " != " << ref << std::endl;
std::cout << "Error in output " << test << " != " << ref
<< std::endl;
errors++;
} else {
if (verbosity >= 1)
std::cout << "Correct output " << test << " == " << ref << std::endl;
std::cout << "Correct output " << test << " == " << ref
<< std::endl;
}
}
auto vstop = std::chrono::system_clock::now();
Expand Down
3 changes: 2 additions & 1 deletion programming_guide/section-4/section-4b/vector_scalar_mul.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ void vector_scalar_mul_aie_scalar(int32_t *a, int32_t *c, int32_t *factor,
for (int i = 0; i < N; i++) {
c[i] = *factor * a[i];
}
event1();}
event1();
}
} // extern "C"

0 comments on commit d6b829b

Please sign in to comment.