edit aiter_opus_plus.h using opus api instead of asm code#3932
Open
junhaha666 wants to merge 1 commit into
Open
edit aiter_opus_plus.h using opus api instead of asm code#3932junhaha666 wants to merge 1 commit into
junhaha666 wants to merge 1 commit into
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors parts of the low-level quantization/packing utilities to rely on OPUS API/builtins rather than inline GCN asm, and extends opus.hpp with additional packing helpers needed by aiter_opus_plus.h.
Changes:
- Add
fp32 -> bf8packed conversion helper inopus.hpp. - Add
fp16 -> fp4packed helpers inopus.hppand switchaiter_opus_plus.hto delegate to these helpers. - Replace inline asm sequences for
fp32 -> {fp8,bf8}packed conversion inaiter_opus_plus.hwith OPUS helpers +med3clamp.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| csrc/include/opus/opus.hpp | Adds new bf8/fp4 packing helpers and adjusts some fp4/bf16 conversion plumbing. |
| csrc/include/aiter_opus_plus.h | Removes inline asm for packed fp8/bf8 conversion and delegates fp16→fp4 packing to opus.hpp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1258
to
+1259
| int w ; w = __builtin_amdgcn_cvt_pk_bf8_f32(s[0], s[1], w, sel); | ||
| return __builtin_bit_cast(bf8x2_t, static_cast<short>(w)); |
Comment on lines
+1351
to
+1352
| u32_t w; w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, s, scale, sel); | ||
| return __builtin_bit_cast(array<fp4_t, 1>, static_cast<u8_t>(w)); |
Comment on lines
+1356
to
+1357
| u32_t w; w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[0], s[1]}, scale, 0); w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[2], s[3]}, scale, 1); | ||
| return __builtin_bit_cast(array<fp4_t, 2>, static_cast<u16_t>(w)); |
Comment on lines
+1361
to
+1363
| u32_t w; w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[0], s[1]}, scale, 0); w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[2], s[3]}, scale, 1); | ||
| w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[4], s[5]}, scale, 2); w = __builtin_amdgcn_cvt_scalef32_pk_fp4_f16(w, fp16x2_t{s[6], s[7]}, scale, 3); | ||
| return __builtin_bit_cast(array<fp4_t, 4>, w); |
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
Technical Details
Test Plan
Test Result
Submission Checklist