Skip to content

Commit

Permalink
Fix kernel not triggering in fuzz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PatKamin committed Mar 21, 2024
1 parent 44686f9 commit 93618c1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ jobs:
-DUR_BUILD_ADAPTER_L0=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
-DUR_CONFORMANCE_TARGET_TRIPLES=spir64
- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
-DUR_BUILD_ADAPTER_L0=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
-DUR_CONFORMANCE_TARGET_TRIPLES=spir64
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function(add_fuzz_test name label)
ENVIRONMENT "${ENV_VARS}")
# TODO: Should we check if this sanitizer flag is available?
target_compile_options(${TEST_TARGET_NAME} PRIVATE -g -fsanitize=fuzzer)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE -DKERNEL_IL_PATH="${UR_CONFORMANCE_DEVICE_BINARIES_DIR}/bar/sycl_spir641.spv")
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE -DKERNEL_IL_PATH="${UR_CONFORMANCE_DEVICE_BINARIES_DIR}/bar/sycl_spir64.spv")
target_include_directories(${TEST_TARGET_NAME} PRIVATE ${UR_CONFORMANCE_DEVICE_BINARIES_DIR})

add_dependencies(${TEST_TARGET_NAME} generate_device_binaries)
Expand Down
10 changes: 5 additions & 5 deletions test/fuzz/urFuzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ int ur_program_create_with_il(TestState &state) {
}

std::vector<char> il_bin;
ur_program_handle_t program = nullptr;
ur_kernel_handle_t kernel = nullptr;
ur_queue_handle_t queue = nullptr;
ur_event_handle_t event = nullptr;
ur_program_handle_t program;
ur_kernel_handle_t kernel;
ur_queue_handle_t queue;
ur_event_handle_t event;
auto &context = state.contexts[state.context_num]->handle;
auto &device = state.devices[state.device_num];
std::string kernel_name =
uur::device_binaries::program_kernel_map["bar"][0];
uur::device_binaries::program_kernel_map["foo"][0];

il_bin = state.load_kernel_source();
if (il_bin.empty()) {
Expand Down
6 changes: 5 additions & 1 deletion test/fuzz/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ struct TestState {
uint8_t context_num;

TestState(std::unique_ptr<FuzzedDataProvider> data_provider)
: data_provider(std::move(data_provider)) {}
: data_provider(std::move(data_provider)) {
num_adapters = 0;
num_platforms = 0;
num_devices = 0;
}

template <typename IntType> int get_next_input_data(IntType *data) {
if (data_provider->remaining_bytes() < sizeof(IntType)) {
Expand Down

0 comments on commit 93618c1

Please sign in to comment.