Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_applications_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: "Build Applications CUDA"
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
defaults:
run:
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_applications_vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1
GLFW_DIR: C:\glfw-3.4.bin.WIN64\

jobs:
Expand Down Expand Up @@ -52,8 +52,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_hip_basic_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: "Build HIP Basic CUDA"
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
defaults:
run:
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_hip_basic_vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1
VULKAN_SDK: C:\VulkanSDK\1.4.313.2\
GLFW_DIR: C:\glfw-3.4.bin.WIN64\

Expand Down Expand Up @@ -57,8 +57,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_hip_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
wget https://repo.radeon.com/amdgpu-install/${{ env.ROCM_VERSION }}/ubuntu/jammy/amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb
apt-get -y install ./amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb &&
apt-get update -qq &&
apt-get -y install rocm-dev rocm-llvm-dev hipfft-dev
apt-get -y install rocm-dev rocm-llvm-dev hipfft-dev hipcub-dev
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_hip_documentation_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: "Build HIP Documentation CUDA"
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
defaults:
run:
shell: bash
Expand All @@ -46,7 +46,7 @@ jobs:
wget https://repo.radeon.com/amdgpu-install/${{ env.ROCM_VERSION }}/ubuntu/jammy/amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb
apt-get -y install ./amdgpu-install_${{ env.AMDGPU_INSTALLER_VERSION }}_all.deb &&
apt-get update -qq &&
apt-get install -y hip-dev hipify-clang hipfft-dev
apt-get install -y hip-dev hipify-clang hipfft-dev hipcub-dev

- name: Configure and Build
# The CMAKE_POLICY_VERSION_MINIMUM environment variable can be removed once the CMake updates from ROCm 7.0 are available
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_hip_documentation_vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1
VULKAN_SDK: C:\VulkanSDK\1.4.313.2\
GLFW_DIR: C:\glfw-3.4.bin.WIN64\

Expand Down Expand Up @@ -57,8 +57,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_libraries_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run:
shell: bash
container:
image: ghcr.io/rocm/rocm-examples-hip-libraries-cuda-ubuntu
image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
options: --user root

steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_libraries_vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1

jobs:
build:
Expand All @@ -46,8 +46,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build_portable_sln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
CUDA_VERSION: 12.8.1
CUDA_INSTALLER_VERSION: 572.61
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1
CUDA_VERSION: 12.9.1
CUDA_INSTALLER_VERSION: 576.57
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.9
GLFW_DIR: C:\glfw-3.4.bin.WIN64\
VULKAN_SDK: C:\VulkanSDK\1.4.313.2\

Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
Write-Host "Downloading installer https://developer.download.nvidia.com/compute/cuda/${{ env.CUDA_VERSION }}/local_installers/cuda_${{ env.CUDA_VERSION }}_${{ env.CUDA_INSTALLER_VERSION }}_windows.exe"
Invoke-WebRequest -Uri https://developer.download.nvidia.com/compute/cuda/${{ env.CUDA_VERSION }}/local_installers/cuda_${{ env.CUDA_VERSION }}_${{ env.CUDA_INSTALLER_VERSION }}_windows.exe -OutFile CUDAToolkit.exe
Write-Host "Installing CUDA Toolkit"
Start-Process CUDAToolkit.exe -ArgumentList '-s cuda_profiler_api_12.8 cudart_12.8 nvcc_12.8 nvrtc_dev_12.8 cublas_dev_12.8 cufft_dev_12.8 curand_dev_12.8 cusolver_dev_12.8 cusparse_dev_12.8 visual_studio_integration_12.8','-n' -NoNewWindow -Wait
Start-Process CUDAToolkit.exe -ArgumentList '-s cuda_profiler_api_12.9 cudart_12.9 nvcc_12.9 nvrtc_dev_12.9 cublas_dev_12.9 cufft_dev_12.9 curand_dev_12.9 cusolver_dev_12.9 cusparse_dev_12.9 visual_studio_integration_12.9','-n' -NoNewWindow -Wait
if (Test-Path -Path "${{ env.CUDA_PATH }}") {
Write-Host "CUDA_PATH directory exists: ${{ env.CUDA_PATH }}"
Write-Host "CUDA Toolkit installed successfully"
Expand All @@ -83,8 +83,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_programming_guide_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: "Build ROCm Programming Guide CUDA"
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.8.1-cudnn-devel-ubuntu22.04
image: nvidia/cuda:12.9.1-cudnn-devel-ubuntu22.04
defaults:
run:
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_programming_guide_vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ concurrency:
cancel-in-progress: true

env:
PLATFORM_TOOLSET_VERSION: 6.4
HIP_PATH: C:\Program Files\AMD\ROCm\6.4\
HIPSDK_INSTALLER_VERSION: 25.Q3
PLATFORM_TOOLSET_VERSION: 7.1
HIP_PATH: C:\Program Files\AMD\ROCm\7.1\
HIPSDK_INSTALLER_VERSION: 26.Q1
VULKAN_SDK: C:\VulkanSDK\1.4.313.2\
GLFW_DIR: C:\glfw-3.4.bin.WIN64\

Expand All @@ -47,8 +47,8 @@ jobs:
- name: Install HIP SDK
run: |
$ProgressPreference = 'SilentlyContinue'
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win10-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Downloading installer https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe"
Invoke-WebRequest -Uri https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-Win11-For-HIP.exe -OutFile HIPSDK.exe
Write-Host "Installing HIP SDK"
Start-Process HIPSDK.exe -ArgumentList '-install','-log',"$((Get-Location).Path)\installer_log.txt" -NoNewWindow -Wait
Write-Host "Installer log:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ project(HIP-Doc-Programming-Guide-Porting-CUDA-code-to-HIP LANGUAGES CXX)
file(RELATIVE_PATH folder_bin ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

add_subdirectory(address_retrieval)
add_subdirectory(device_code_feature_identification)
add_subdirectory(host_code_feature_identification)
Expand All @@ -40,5 +56,12 @@ else()
add_subdirectory(load_module_ex_cuda)
endif()

find_package(hipcub QUIET)
if(NOT hipcub_FOUND)
message(STATUS "hipCUB not found. Skipping lane masks bit-shift example.")
else()
add_subdirectory(lane_masks_bit_shift)
endif()

add_subdirectory(per_thread_default_stream)
add_subdirectory(pointer_memory_type)
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ EXAMPLES := \
host_code_feature_identification \
identifying_compilation_target_platform \
identifying_host_device_compilation_pass \
lane_masks_bit_shift \
load_module \
load_module_ex \
per_thread_default_stream \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hip_lane_masks_bit_shift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# MIT License
#
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set(example_name hip_lane_masks_bit_shift)

cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(${example_name} LANGUAGES CXX)

include("${CMAKE_CURRENT_LIST_DIR}/../../../../Common/HipPlatform.cmake")
select_gpu_language()
enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE})
select_hip_platform()

if(ROCM_EXAMPLES_GPU_LANGUAGE STREQUAL "CUDA")
# The example calls hipDeviceGetAttribute which internally uses the CUDA
# driver API. We must explicitly link the driver library.
find_package(CUDAToolkit REQUIRED)
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

if(NOT TARGET hip::hipcub)
find_package(hipcub REQUIRED)
endif()

add_executable(${example_name} main.hip)
# Make example runnable using ctest
add_test(NAME ${example_name} COMMAND ${example_name})

set_source_files_properties(main.hip PROPERTIES LANGUAGE ${ROCM_EXAMPLES_GPU_LANGUAGE})

set_target_properties(${example_name} PROPERTIES $<$<COMPILE_LANGUAGE:CUDA>:CUDA_EXTENSIONS OFF>
$<$<COMPILE_LANGUAGE:HIP>:HIP_EXTENSIONS OFF>)
target_compile_features(${example_name} PRIVATE cuda_std_17 hip_std_17)
target_include_directories(${example_name} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:${ROCM_ROOT}/include>)
target_link_libraries(${example_name} PRIVATE $<$<LINK_LANGUAGE:CUDA>:CUDA::cuda_driver> hip::hipcub)

install(TARGETS ${example_name})
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# MIT License
#
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

EXAMPLE := hip_lane_masks_bit_shift
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
ICXXFLAGS := -std=$(CXX_STD)
ICPPFLAGS :=
ILDFLAGS :=
ILDLIBS :=

ifeq ($(GPU_RUNTIME), CUDA)
ICXXFLAGS += -x cu
ICPPFLAGS += -isystem $(HIP_INCLUDE_DIR)
else ifeq ($(GPU_RUNTIME), HIP)
CXXFLAGS ?= -Wall -Wextra
else
$(error GPU_RUNTIME is set to "$(GPU_RUNTIME)". GPU_RUNTIME must be either CUDA or HIP)
endif

ICXXFLAGS += $(CXXFLAGS)
ICPPFLAGS += $(CPPFLAGS)
ILDFLAGS += $(LDFLAGS)
ILDLIBS += $(LDLIBS)

$(EXAMPLE): main.hip
$(HIPCXX) $(ICXXFLAGS) $(ICPPFLAGS) $(ILDFLAGS) -o $@ $< $(ILDLIBS)

clean:
$(RM) $(EXAMPLE)

.PHONY: clean
Loading
Loading