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

matmul_nbits: Use GPU_WARP_SIZE_HOST for host side code #65

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

jagadish-amd
Copy link

For ROCm device, the host side code needs to call GPU_WARP_SIZE_HOST to query warpsize of the underlying GPU device.

Fixes MatMulNBits tests on Navi.

For ROCm device, the host side code needs to call GPU_WARP_SIZE_HOST to
query warpsize of the underlying GPU device.

Fixes MatMulNBits tests on Navi.

Signed-off-by: Jagadish Krishnamoorthy <[email protected]>
@@ -288,6 +288,7 @@ bool TryMatMul4Bits(
if (n % kColsPerThreadBlock != 0 || k % 8 != 0 || m > 1) {
return false;
}
const int kWarpSize = GPU_WARP_SIZE_HOST;
Copy link

@TedThemistokleous TedThemistokleous Sep 10, 2024

Choose a reason for hiding this comment

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

Put a #if around this via how we handle things with USE_ROCM and USE_MIGRAPHX

#if USE_MIGRAPHX || USE_ROCM
const int kWarpSize = GPU_WARP_SIZE_HOST;
#endif 

That way if once we upstream this change it wouldn't break another EP if this is specific to AMD

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to ifdef protect this. CUDA EP also defines GPU_WARP_SIZE_HOST for this reason.

Choose a reason for hiding this comment

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

Ah then my real curiosity is why redefine it here then if that's the case?

onnxruntime/contrib_ops/cuda/quantization/matmul_nbits.cu Outdated Show resolved Hide resolved
@@ -288,6 +288,7 @@ bool TryMatMul4Bits(
if (n % kColsPerThreadBlock != 0 || k % 8 != 0 || m > 1) {
return false;
}
const int kWarpSize = GPU_WARP_SIZE_HOST;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to ifdef protect this. CUDA EP also defines GPU_WARP_SIZE_HOST for this reason.

@jeffdaily jeffdaily merged commit d7e1c61 into ROCm:rocm6.3_internal_testing Sep 10, 2024
5 of 10 checks passed
@jeffdaily
Copy link
Collaborator

@jagadish-amd please file upstream PR for same change.

@jagadish-amd jagadish-amd deleted the fix_matmul4 branch September 10, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants