From 0ac5ab71c838f5c4851099d160be90646241b349 Mon Sep 17 00:00:00 2001 From: Akshay Tondak Date: Mon, 9 Dec 2024 11:42:58 -0800 Subject: [PATCH] Fix for spatial sharing crash Signed-off-by: Akshay Tondak --- .../core/tools/common/tests/TestSpatialSharingOvd.cpp | 4 ++-- .../core/tools/common/tests/TestTemporalSharingOvd.cpp | 4 ++-- .../core/tools/common/tests/TestValidateUtilities.cpp | 5 +++-- src/runtime_src/core/tools/xbutil2/xbutil.cpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp index 17f2a002936..56ce924b7da 100644 --- a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp @@ -15,7 +15,7 @@ namespace XBU = XBUtilities; static constexpr size_t host_app = 1; //opcode -static constexpr size_t buffer_size = 1024; //1 KB +static constexpr size_t buffer_size = 1024 * 1024 * 1024; //1 GB // Method to run the test // Parameters: @@ -96,7 +96,7 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr testcases; // Create two test cases and add them to the vector - TestParams params(xclbin, working_dev, kernelName, dpu_instr, 8, buffer_size, 10000); + TestParams params(xclbin, working_dev, kernelName, dpu_instr, 2, buffer_size, 10); testcases.emplace_back(params); testcases.emplace_back(params); diff --git a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp index 8abe04217cf..8df22ce16c6 100644 --- a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp @@ -17,7 +17,7 @@ namespace XBU = XBUtilities; -static constexpr size_t buffer_size = 1024; //1 KB +static constexpr size_t buffer_size = 1024*1024*1024; //1 GB boost::property_tree::ptree TestTemporalSharingOvd::run(std::shared_ptr dev) { @@ -67,7 +67,7 @@ TestTemporalSharingOvd::run(std::shared_ptr dev) { std::vector testcases; // Create two test cases and add them to the vector - TestParams params(xclbin, working_dev, kernelName, dpu_instr, 8, buffer_size, 10000); + TestParams params(xclbin, working_dev, kernelName, dpu_instr, 1, buffer_size, 10); testcases.emplace_back(params); testcases.emplace_back(params); diff --git a/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp index 5d49b6eabc3..0374e72c53c 100644 --- a/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp +++ b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp @@ -34,7 +34,8 @@ BO_set::BO_set(const xrt::device& device, const xrt::kernel& kernel, const std:: std::memset(bo_instr.map(), (uint8_t)0, buffer_size); } else { size_t instr_size = XBValidateUtils::get_instr_size(dpu_instr); - bo_instr = xrt::bo(device, instr_size, XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); + bo_instr = xrt::bo(device, instr_size * sizeof(int), XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); } } @@ -57,7 +58,7 @@ void BO_set::set_kernel_args(xrt::run& run) const { run.set_arg(3, bo_ofm); run.set_arg(4, bo_inter); run.set_arg(5, bo_instr); - run.set_arg(6, buffer_size/sizeof(int)); + run.set_arg(6, bo_instr.size()/sizeof(int)); run.set_arg(7, bo_mc); } diff --git a/src/runtime_src/core/tools/xbutil2/xbutil.cpp b/src/runtime_src/core/tools/xbutil2/xbutil.cpp index 980d52486f0..0502eed078e 100644 --- a/src/runtime_src/core/tools/xbutil2/xbutil.cpp +++ b/src/runtime_src/core/tools/xbutil2/xbutil.cpp @@ -66,7 +66,7 @@ R"( }] },{ "validate": [{ - "test": ["spatial-sharing-overhead", "latency", "throughput", "cmd-chain-latency", "cmd-chain-throughput", "df-bw", "tct-one-col", "tct-all-col", "gemm", "aie-reconfig-overhead", temporal-sharing-overhead"] + "test": ["latency", "throughput", "cmd-chain-latency", "cmd-chain-throughput", "df-bw", "tct-one-col", "tct-all-col", "gemm", "aie-reconfig-overhead", "spatial-sharing-overhead", "temporal-sharing-overhead"] }] }] }]