CMake cleanup: define cmd prefix for ocloc in one place
rename cloc_cmd_prefix -> ocloc_cmd_prefix rename __cloc__options -> __ocloc__options Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
c16eb0ff84
commit
3e5d68deab
|
@ -748,6 +748,7 @@ endif()
|
|||
|
||||
add_subdirectory_unique(${OCLOC_DIRECTORY} ${NEO_BUILD_DIR}/offline_compiler)
|
||||
target_compile_definitions(ocloc_lib PRIVATE MOCKABLE_VIRTUAL=)
|
||||
include(cmake/ocloc_cmd_prefix.cmake)
|
||||
|
||||
if(DONT_CARE_OF_VIRTUALS)
|
||||
set(NEO_SHARED_RELEASE_LIB_NAME "neo_shared")
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
set(ocloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(ocloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(ocloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
|
@ -7,17 +7,6 @@
|
|||
function(level_zero_gen_kernels target_list platform_name suffix options)
|
||||
|
||||
if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND results copy_compiler_files)
|
||||
endif()
|
||||
|
||||
|
@ -36,9 +25,9 @@ function(level_zero_gen_kernels target_list platform_name suffix options)
|
|||
)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND echo generate ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
|
||||
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filepath} ocloc
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
)
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
list(APPEND __cloc__options__ "-D DEBUG")
|
||||
list(APPEND __ocloc__options__ "-D DEBUG")
|
||||
endif()
|
||||
|
||||
set(BUILTINS_INCLUDE_DIR ${TargetDir} PARENT_SCOPE)
|
||||
|
@ -61,22 +61,11 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
unset(BUILTIN_CPP)
|
||||
# set variable outside function
|
||||
set(BUILTIN_CPP built_ins/${NEO_ARCH}/${gen_type_lower}/${BASENAME}_${family_name_with_type}.cpp PARENT_SCOPE)
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND __cloc__options__ "-cl-kernel-arg-info")
|
||||
list(APPEND __ocloc__options__ "-cl-kernel-arg-info")
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_FILES}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${FILENAME} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__cloc__options__}, >"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${FILENAME} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__ocloc__options__}, >"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${builtin} ocloc copy_compiler_files
|
||||
)
|
||||
|
|
|
@ -11,11 +11,11 @@ set_target_properties(scheduler PROPERTIES FOLDER "${OPENCL_RUNTIME_PROJECTS_FOL
|
|||
|
||||
set(SCHEDULER_KERNEL scheduler.cl)
|
||||
if(DEFINED NEO__IGC_INCLUDE_DIR)
|
||||
list(APPEND __cloc__options__ "-I$<JOIN:${NEO__IGC_INCLUDE_DIR}, -I>")
|
||||
list(APPEND __ocloc__options__ "-I$<JOIN:${NEO__IGC_INCLUDE_DIR}, -I>")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
list(APPEND __cloc__options__ "-D DEBUG")
|
||||
list(APPEND __ocloc__options__ "-D DEBUG")
|
||||
endif()
|
||||
|
||||
set(SCHEDULER_INCLUDE_DIR ${TargetDir})
|
||||
|
@ -25,7 +25,7 @@ function(compile_kernel target gen_type platform_type kernel)
|
|||
string(TOLOWER ${gen_type} gen_type_lower)
|
||||
# get filename
|
||||
set(OUTPUTDIR "${SCHEDULER_OUTDIR_WITH_ARCH}/${gen_type_lower}")
|
||||
list(APPEND __cloc__options__ "-I ../${gen_type_lower}")
|
||||
list(APPEND __ocloc__options__ "-I ../${gen_type_lower}")
|
||||
|
||||
get_filename_component(BASENAME ${kernel} NAME_WE)
|
||||
|
||||
|
@ -33,23 +33,12 @@ function(compile_kernel target gen_type platform_type kernel)
|
|||
|
||||
set(SCHEDULER_CPP "${OUTPUTDIR}/${BASENAME}_${family_name_with_type}.cpp")
|
||||
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND __cloc__options__ "-cl-kernel-arg-info")
|
||||
list(APPEND __cloc__options__ "-cl-std=CL2.0")
|
||||
list(APPEND __cloc__options__ "-cl-intel-disable-a64WA")
|
||||
list(APPEND __ocloc__options__ "-cl-kernel-arg-info")
|
||||
list(APPEND __ocloc__options__ "-cl-std=CL2.0")
|
||||
list(APPEND __ocloc__options__ "-cl-intel-disable-a64WA")
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUTPATH}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${kernel} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "$<JOIN:${__cloc__options__}, >" -internal_options "-cl-intel-no-spill"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${kernel} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "$<JOIN:${__ocloc__options__}, >" -internal_options "-cl-intel-no-spill"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${kernel} ocloc copy_compiler_files
|
||||
)
|
||||
|
|
|
@ -178,18 +178,6 @@ target_include_directories(igdrcl_tests BEFORE PRIVATE
|
|||
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/includes${BRANCH_DIR_SUFFIX}
|
||||
)
|
||||
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(neo_gen_kernels platform_name_with_type platform_name revision_id suffix)
|
||||
set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/")
|
||||
|
||||
|
@ -209,7 +197,7 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filepath} ocloc
|
||||
)
|
||||
|
@ -255,7 +243,7 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
|
||||
COMMAND ${ocloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filearg} ocloc
|
||||
)
|
||||
|
@ -307,7 +295,7 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
|
||||
COMMAND ${ocloc_cmd_prefix} -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filearg} ocloc
|
||||
)
|
||||
|
@ -353,7 +341,7 @@ function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platfo
|
|||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filepath} ocloc
|
||||
)
|
||||
|
@ -389,7 +377,7 @@ function(neo_gen_kernel_from_ll platform_name_with_type platform_name suffix fil
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filepath} ocloc
|
||||
)
|
||||
|
|
|
@ -35,7 +35,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
)
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
list(APPEND __cloc__options__ "-D DEBUG")
|
||||
list(APPEND __ocloc__options__ "-D DEBUG")
|
||||
endif()
|
||||
|
||||
set(BUILTINS_INCLUDE_DIR ${TargetDir} PARENT_SCOPE)
|
||||
|
@ -64,22 +64,11 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
${OUTPUTDIR}/${mode}_${BASENAME}_${family_name_with_type}.spv
|
||||
)
|
||||
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND __cloc__options__ "-cl-kernel-arg-info")
|
||||
list(APPEND __ocloc__options__ "-cl-kernel-arg-info")
|
||||
set(INTERNAL_OPTIONS "${${mode}_OPTIONS}")
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_FILE_SPV}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${FILENAME} -spv_only -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${FILENAME} -spv_only -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${builtin} ocloc copy_compiler_files
|
||||
)
|
||||
|
@ -95,7 +84,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
list(APPEND BUILTINS_COMMANDS "${OUTPUT_FILE_CPP}")
|
||||
add_custom_command(
|
||||
OUTPUT ${OUTPUT_FILES_BINARIES}
|
||||
COMMAND ${cloc_cmd_prefix} -q -file ${OUTPUT_FILE_SPV} -spirv_input -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -file ${OUTPUT_FILE_SPV} -spirv_input -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files
|
||||
)
|
||||
|
@ -110,18 +99,6 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
endfunction()
|
||||
|
||||
function(generate_cpp_spirv builtin)
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_filename_component(BASENAME ${builtin} NAME_WE)
|
||||
get_filename_component(DIR ${builtin} DIRECTORY)
|
||||
|
||||
|
@ -139,7 +116,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
|
|||
set(OUTPUT_LIST_CPP_FILES ${OUTPUT_LIST_CPP_FILES} ${OUTPUT_FILE_CPP} PARENT_SCOPE)
|
||||
add_custom_command(
|
||||
OUTPUT ${GENERATED_SPV_INPUT}
|
||||
COMMAND ${cloc_cmd_prefix} -q -spv_only -file ${INPUT_FILENAME} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
|
||||
COMMAND ${ocloc_cmd_prefix} -q -spv_only -file ${INPUT_FILENAME} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${INPUT_FILENAME} ocloc copy_compiler_files
|
||||
)
|
||||
|
|
|
@ -5,18 +5,6 @@
|
|||
#
|
||||
|
||||
set(SHARED_TEST_PROJECTS_SUB_FOLDER "prepare test files")
|
||||
if(NOT DEFINED cloc_cmd_prefix)
|
||||
if(WIN32)
|
||||
set(cloc_cmd_prefix ocloc)
|
||||
else()
|
||||
if(DEFINED NEO__IGC_LIBRARY_PATH)
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
else()
|
||||
set(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(compile_kernels_gen platform_name_with_type revision_id platform_name suffix)
|
||||
|
||||
set(outputdir "${TargetDir}/${suffix}/${revision_id}/test_files/${NEO_ARCH}/")
|
||||
|
@ -38,7 +26,7 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s
|
|||
|
||||
add_custom_command(
|
||||
OUTPUT ${output_files}
|
||||
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
|
||||
COMMAND ${ocloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
|
||||
WORKING_DIRECTORY ${workdir}
|
||||
DEPENDS ${filepath} ocloc copy_compiler_files
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue