Fix FP8 round-trip example on non-native GPUs - #498
Open
skyguan92 wants to merge 1 commit into
Open
Conversation
Decode raw FP8 storage through the HIP half conversion helper so the example validates numeric round trips instead of encoded byte values. Use the portable device conversion path on architectures without native FP8 instructions. Signed-off-by: guanjiawei <128683929+skyguan92@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The FP8 example currently exits before launching its kernel unless the device is
gfx94x. Current HIP headers also provide host/device software conversion pathswhen native FP8 conversion instructions are unavailable, so this excludes GPUs
that can execute the example correctly.
The round-trip validation also assigns raw
__hip_fp8_storage_tbytes directlyto
float. That compares the numeric value of the encoded byte instead of thedecoded FP8 value.
Technical Details
__hip_cvt_fp8_to_halfrawin a shared host/devicehelper.
gfx94xearly exit while retaining the existing FNUZselection for
gfx94xand OCP E4M3 elsewhere.size_tfor the kernel index to remove the signed/unsigned warning.This change enables correctness coverage; it does not claim native FP8 hardware
acceleration on architectures such as
gfx1100.Test Plan
Test the exact commit on physical
gfx1100, compare the unmodified baseline,exercise both Make and CMake builds, validate the complete E4M3 raw-code space
plus a broad float corpus, trace the kernel dispatch, and compile the CI
architecture set.
Test Result
Tested on two independently selected AMD Radeon Pro W7900D devices (GPU 0 and
GPU 7) with ROCm 7.14.0 / HIP 7.14.60850 in
rocm/dev-ubuntu-24.04:7.14.0-full-amd64-digest-439edaa8.Need a gfx94xand exits without launching the conversion kernel on both devices.
CPU and GPU round trip convert matcheson both devices.devices.
float inputs match between host and device on both devices. The known-value
oracle also passes:
1.1 -> 0x39 -> 1.125.rocprofv3 --kernel-tracerecords onefloat_to_fp8_to_float(..., unsigned long)dispatch with a 32-thread workgroup.-Wall -Wextra -Werrorfat binary builds for the CI set:gfx908,gfx90a,gfx942,gfx950,gfx1030,gfx1100,gfx1101,gfx1200, andgfx1201.clang-format18,git diff --check, and markdownlint pass.Added/Updated documentation?
Included Visual Studio files?
Submission Checklist
HIP-Doc build.
portable conversion path used here.