Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer error message and HIP architectures #293

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ else()
endif()
set(HIP_PATH "${ROCM_PATH}/hip" CACHE STRING "path to HIP installation")
if(GTENSOR_GPU_ARCHITECTURES STREQUAL "default")
set(HIP_GPU_ARCHITECTURE "gfx90a")
set(CMAKE_HIP_ARCHITECTURES "gfx90a")
else()
set(CMAKE_CUDA_ARCHITECTURES ${GTENSOR_GPU_ARCHITECTURES})
set(CMAKE_HIP_ARCHITECTURES ${GTENSOR_GPU_ARCHITECTURES})
endif()

# SYCL specific configuration
Expand Down Expand Up @@ -201,8 +201,8 @@ if ("hip" IN_LIST GTENSOR_BUILD_DEVICES)
target_compile_definitions(gtensor_hip INTERFACE GTENSOR_HAVE_DEVICE)
target_compile_definitions(gtensor_hip INTERFACE GTENSOR_DEVICE_HIP)

set(GPU_TARGETS "${HIP_GPU_ARCHITECTURES}"
CACHE STRING "GPU targets to compile for")
#set(GPU_TARGETS "${HIP_GPU_ARCHITECTURES}"
# CACHE STRING "GPU targets to compile for")
Comment on lines +204 to +205
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just remove these two lines? I guess it looks like GPU_TARGETS isn't being used at all currently, right?

find_package(hip REQUIRED)
find_package(rocthrust REQUIRED)

Expand Down
6 changes: 4 additions & 2 deletions include/gtensor/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ inline auto gpuGetLastError() { return cudaGetLastError(); }
inline void gtLaunchCheck(dim3 numblocks, dim3 numthreads, const char* file,
int line)
{
if (hipGetLastError() != hipSuccess) {
fprintf(stderr, "launch failed %s %d\n", file, line);
hipError_t last_error = hipGetLastError();
if (last_error != hipSuccess) {
fprintf(stderr, "launch failed %s %d, error_code: %d\n", file, line,last_error);
fprintf(stderr, "(%s)\n", hipGetErrorString(last_error));
Comment on lines +93 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except that clang-format complains, so please update the formatting.

fprintf(stderr, "blocks was [%d, %d, %d]\n", numblocks.x, numblocks.y,
numblocks.z);
fprintf(stderr, "threads was [%d, %d, %d]\n", numthreads.x, numthreads.y,
Expand Down
Loading