CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
93 lines
6.3 KiB
CMake
93 lines
6.3 KiB
CMake
# Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
set(ops_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../tensilelite")
|
|
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}")
|
|
string(REGEX MATCHALL "gfx[a-z0-9]+" archs "${GPU_TARGETS}")
|
|
list(REMOVE_DUPLICATES archs)
|
|
message(STATUS "Architectures to process: ${archs}")
|
|
|
|
set(previous_target "")
|
|
|
|
foreach(arch IN LISTS archs)
|
|
message(STATUS "hipblaslt device library extops: Configuring target for architecture ${arch} for hipblasltExtOpLibrary")
|
|
tensilelite_offload_target(offload_arch "${arch}")
|
|
set(extop_xnack_args)
|
|
if(NOT "${offload_arch}" STREQUAL "${arch}")
|
|
set(extop_xnack_args --xnack)
|
|
endif()
|
|
set(WAVEFRONT "-mwavefrontsize64")
|
|
if(arch MATCHES "^gfx1[12][0-9][0-9]$")
|
|
set(WAVEFRONT "-mno-wavefrontsize64")
|
|
endif()
|
|
add_library(extop-obj-${arch} OBJECT)
|
|
target_compile_options(extop-obj-${arch}
|
|
PRIVATE
|
|
-Wno-unused-command-line-argument -x assembler -target amdgcn-amd-amdhsa -mcode-object-version=4 -mcpu=${offload_arch} ${WAVEFRONT} -c
|
|
)
|
|
target_sources(extop-obj-${arch}
|
|
PRIVATE
|
|
"${CMAKE_CURRENT_BINARY_DIR}/L_256_4_1_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/L_256_4_0_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_8_32_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_16_16_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_4_64_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_2_128_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_1_256_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_S_S_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_H_H_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_H_S_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_S_H_256_4_${arch}.s"
|
|
)
|
|
add_custom_command(
|
|
OUTPUT
|
|
"${CMAKE_CURRENT_BINARY_DIR}/L_256_4_1_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/L_256_4_0_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_8_32_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_16_16_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_4_64_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_2_128_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/S_1_256_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_S_S_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_H_H_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_H_S_256_4_${arch}.s"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/A_S_H_256_4_${arch}.s"
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/LayerNormGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/L_256_4_1_${arch}.s" -w 256 -c 4 --sweep-once 1 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/LayerNormGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/L_256_4_0_${arch}.s" -w 256 -c 4 --sweep-once 0 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/SoftmaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/S_8_32_${arch}.s" -m 8 -n 32 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/SoftmaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/S_16_16_${arch}.s" -m 16 -n 16 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/SoftmaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/S_4_64_${arch}.s" -m 4 -n 64 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/SoftmaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/S_2_128_${arch}.s" -m 2 -n 128 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/SoftmaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/S_1_256_${arch}.s" -m 1 -n 256 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/AMaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/A_S_S_256_4_${arch}.s" -t S -d S -w 256 -c 4 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/AMaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/A_H_H_256_4_${arch}.s" -t H -d H -w 256 -c 4 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/AMaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/A_H_S_256_4_${arch}.s" -t H -d S -w 256 -c 4 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/AMaxGenerator.py" -o "${CMAKE_CURRENT_BINARY_DIR}/A_S_H_256_4_${arch}.s" -t S -d H -w 256 -c 4 --arch ${arch} --toolchain ${CMAKE_CXX_COMPILER} ${extop_xnack_args}
|
|
COMMENT "Creating Layer Norm, Softmax and Amax Assembly for ${arch}"
|
|
DEPENDS ${HIPBLASLT_PYTHON_DEPS}
|
|
)
|
|
|
|
set(output_code_object_file "${CMAKE_CURRENT_BINARY_DIR}/extop_${arch}.co")
|
|
add_custom_command(
|
|
DEPENDS extop-obj-${arch}
|
|
OUTPUT "${output_code_object_file}"
|
|
COMMAND ${CMAKE_CXX_COMPILER};-target;amdgcn-amdhsa;-Xlinker;$<TARGET_OBJECTS:extop-obj-${arch}>;-o;${output_code_object_file}
|
|
COMMENT "Creating extop_${arch}"
|
|
COMMAND_EXPAND_LISTS
|
|
)
|
|
|
|
add_custom_target(extop-library-${arch} ALL
|
|
DEPENDS
|
|
"${output_code_object_file}"
|
|
${HIPBLASLT_PYTHON_DEPS}
|
|
${previous_target}
|
|
COMMAND ${HIPBLASLT_PYTHON_COMMAND} "${ops_dir}/ExtOpCreateLibrary.py" --src=${CMAKE_CURRENT_BINARY_DIR} --co=${output_code_object_file} --output=${output_dir} --arch=${arch}
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${HIPBLASLT_TENSILE_LIBPATH}/library/${arch}"
|
|
COMMAND ${CMAKE_COMMAND} -E rm -f "${HIPBLASLT_TENSILE_LIBPATH}/library/${arch}/hipblasltExtOpLibrary_${arch}.dat"
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${output_dir}/hipblasltExtOpLibrary.dat.zlib" "${HIPBLASLT_TENSILE_LIBPATH}/library/${arch}/hipblasltExtOpLibrary_${arch}.dat.zlib"
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${output_code_object_file}" "${HIPBLASLT_TENSILE_LIBPATH}/library/${arch}"
|
|
COMMENT "Creating hipblasltExtOpLibrary_${arch}.dat.zlib"
|
|
)
|
|
set(previous_target "extop-library-${arch}")
|
|
endforeach()
|