Skip to content

[OpenMP] Remove declaration and usage of __AMDGCN_WAVEFRONT_SIZE #143761

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

Merged
merged 3 commits into from
Jun 13, 2025
Merged
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
18 changes: 13 additions & 5 deletions openmp/runtime/src/include/ompx.h.var
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@
#ifndef __OMPX_H
#define __OMPX_H

#ifdef __AMDGCN_WAVEFRONT_SIZE
#define __WARP_SIZE __AMDGCN_WAVEFRONT_SIZE
#else
#define __WARP_SIZE 32
#if (defined(__NVPTX__) || defined(__AMDGPU__))
#include <gpuintrin.h>
#define __OMPX_TARGET_IS_GPU
#endif

typedef unsigned long uint64_t;
typedef unsigned int uint32_t;

static inline uint32_t __warpSize(void) {
#ifdef __OMPX_TARGET_IS_GPU
return __gpu_num_lanes();
#else
__builtin_trap();
#endif
}

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -212,7 +220,7 @@ static inline uint64_t ballot_sync(uint64_t mask, int pred) {
///{
#define _TGT_KERNEL_LANGUAGE_SHFL_DOWN_SYNC(TYPE, TY) \
static inline TYPE shfl_down_sync(uint64_t mask, TYPE var, unsigned delta, \
int width = __WARP_SIZE) { \
int width = __warpSize()) { \
return ompx_shfl_down_sync_##TY(mask, var, delta, width); \
}

Expand Down
Loading