Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
one
TransferBench
Commits
02ce785c
Unverified
Commit
02ce785c
authored
Nov 21, 2024
by
akolliasAMD
Committed by
GitHub
Nov 21, 2024
Browse files
adding default gfx targets (#139)
parent
9658305f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
CMakeLists.txt
CMakeLists.txt
+46
-0
src/header/TransferBench.hpp
src/header/TransferBench.hpp
+1
-1
No files found.
CMakeLists.txt
View file @
02ce785c
...
@@ -8,6 +8,52 @@ endif()
...
@@ -8,6 +8,52 @@ endif()
cmake_minimum_required
(
VERSION 3.5
)
cmake_minimum_required
(
VERSION 3.5
)
project
(
TransferBench VERSION 1.54.0 LANGUAGES CXX
)
project
(
TransferBench VERSION 1.54.0 LANGUAGES CXX
)
# Default GPU architectures to build
#==================================================================================================
set
(
DEFAULT_GPUS
gfx906
gfx908
gfx90a
gfx942
gfx1030
gfx1100
gfx1101
gfx1102
gfx1200
gfx1201
)
# Build only for local GPU architecture
if
(
BUILD_LOCAL_GPU_TARGET_ONLY
)
message
(
STATUS
"Building only for local GPU target"
)
if
(
COMMAND rocm_local_targets
)
rocm_local_targets
(
DEFAULT_GPUS
)
else
()
message
(
WARNING
"Unable to determine local GPU targets. Falling back to default GPUs."
)
endif
()
endif
()
# Determine which GPU architectures to build for
set
(
AMDGPU_TARGETS
"
${
DEFAULT_GPUS
}
"
CACHE STRING
"Target default GPUs if AMDGPU_TARGETS is not defined."
)
# Check if clang compiler can offload to AMDGPU_TARGETS
if
(
COMMAND rocm_check_target_ids
)
message
(
STATUS
"Checking for ROCm support for GPU targets: "
"
${
AMDGPU_TARGETS
}
"
)
rocm_check_target_ids
(
SUPPORTED_GPUS TARGETS
${
AMDGPU_TARGETS
}
)
else
()
message
(
WARNING
"Unable to check for supported GPU targets. Falling back to default GPUs."
)
set
(
SUPPORTED_GPUS
${
DEFAULT_GPUS
}
)
endif
()
set
(
GPU_TARGETS
"
${
SUPPORTED_GPUS
}
"
CACHE STRING
"GPU targets to compile for."
)
message
(
STATUS
"Compiling for
${
GPU_TARGETS
}
"
)
foreach
(
target
${
GPU_TARGETS
}
)
list
(
APPEND static_link_flags --offload-arch=
${
target
}
)
endforeach
()
list
(
JOIN static_link_flags
" "
flags_str
)
set
(
CMAKE_CXX_FLAGS
"
${
flags_str
}${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-O3 --std=c++20 -L
${
ROCM_PATH
}
/lib"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-O3 --std=c++20 -L
${
ROCM_PATH
}
/lib"
)
include_directories
(
${
ROCM_PATH
}
/include
)
include_directories
(
${
ROCM_PATH
}
/include
)
link_libraries
(
numa hsa-runtime64 pthread
)
link_libraries
(
numa hsa-runtime64 pthread
)
...
...
src/header/TransferBench.hpp
View file @
02ce785c
...
@@ -419,7 +419,7 @@ namespace TransferBench
...
@@ -419,7 +419,7 @@ namespace TransferBench
//==========================================================================================
//==========================================================================================
// Macro for collecting CU/SM GFX kernel is running on
// Macro for collecting CU/SM GFX kernel is running on
#if defined(__gfx1100__) || defined(__gfx1101__) || defined(__gfx1102__)
#if defined(__gfx1100__) || defined(__gfx1101__) || defined(__gfx1102__)
|| defined(__gfx1200__) || defined(__gfx1201__)
#define GetHwId(hwId) hwId = 0
#define GetHwId(hwId) hwId = 0
#elif defined(__NVCC__)
#elif defined(__NVCC__)
#define GetHwId(hwId) asm("mov.u32 %0, %smid;" : "=r"(hwId))
#define GetHwId(hwId) asm("mov.u32 %0, %smid;" : "=r"(hwId))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment