From ba9432a929b85761a36f5a31d49ad815fc1c3cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mestre?= Date: Mon, 4 Sep 2023 13:33:57 +0100 Subject: [PATCH] Fix device binary extension for nvptx --- test/conformance/CMakeLists.txt | 3 ++- test/conformance/device_code/CMakeLists.txt | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index b64f9798d4..d74a5e2c7e 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -65,7 +65,8 @@ if(DEFINED UR_DPCXX) file(MAKE_DIRECTORY ${UR_CONFORMANCE_DEVICE_BINARIES_DIR}) if(NOT "${UR_CONFORMANCE_TARGET_TRIPLES}" STREQUAL "") - string(REPLACE "," ";" TARGET_TRIPLES ${UR_CONFORMANCE_TARGET_TRIPLES}) + string(REPLACE "," ";" ${UR_CONFORMANCE_TARGET_TRIPLES} ${UR_CONFORMANCE_TARGET_TRIPLES}) + list(APPEND TARGET_TRIPLES ${UR_CONFORMANCE_TARGET_TRIPLES}) else() message(WARNING "UR_CONFORMANCE_TARGET_TRIPLES wasn't set, defaulting to only generate spir64 device binaries") list(APPEND TARGET_TRIPLES "spir64") diff --git a/test/conformance/device_code/CMakeLists.txt b/test/conformance/device_code/CMakeLists.txt index 1d3f28df7f..4635992903 100644 --- a/test/conformance/device_code/CMakeLists.txt +++ b/test/conformance/device_code/CMakeLists.txt @@ -8,7 +8,15 @@ macro(add_device_binary SOURCE_FILE) set(DEVICE_BINARY_DIR "${UR_CONFORMANCE_DEVICE_BINARIES_DIR}/${KERNEL_NAME}") file(MAKE_DIRECTORY ${DEVICE_BINARY_DIR}) foreach(TRIPLE ${TARGET_TRIPLES}) - set(EXE_PATH "${DEVICE_BINARY_DIR}/${KERNEL_NAME}_${TRIPLE}") + + if ("${TRIPLE}" MATCHES "spir64") + set(EXTENSION ".spv") + elseif("${TRIPLE}" MATCHES "nvptx64") + set(EXTENSION ".bin") + endif() + + set(EXE_PATH "${DEVICE_BINARY_DIR}/${KERNEL_NAME}_${TRIPLE}${EXTENSION}") + add_custom_command(OUTPUT ${EXE_PATH} COMMAND ${UR_DPCXX} -fsycl -fsycl-targets=${TRIPLE} -fsycl-device-code-split=off ${SOURCE_FILE} -o ${EXE_PATH}