Skip to content

Commit

Permalink
Fix device binary extension for nvptx
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomestre committed Sep 4, 2023
1 parent 022bbae commit ba9432a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 9 additions & 1 deletion test/conformance/device_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ba9432a

Please sign in to comment.