Repository navigation
feat(hiptensor): add bf16 and fp32-scalar support to elementwise trinary - #14564
Merged
evedovelli merged 4 commits intoOct 29, 2026
Merged
Conversation
This was referenced Oct 29, 2026
Base automatically changed from
users/evedovel/hiptensor/refactor-elementwise-tests
to
develop
October 29, 2026 15:11
evedovelli
force-pushed
the
users/evedovel/hiptensor/elementwise-trinary-bf16
branch
from
October 29, 2026 15:11
debc3ee to
2a570ad
Compare
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
evedovelli
force-pushed
the
users/evedovel/hiptensor/elementwise-trinary-bf16
branch
from
October 29, 2026 15:34
2a570ad to
3d5d42e
Compare
evedovelli
deleted the
users/evedovel/hiptensor/elementwise-trinary-bf16
branch
October 29, 2026 21:21
Contributor
TheRock Submodule Bump ActivityNewest first
|
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
Elementwise binary accepts six data type combinations: f16, bf16, f32 and f64, with f16 and bf16 also allowed an f32 scalar. Trinary only accepted f16, f32 and f64 with a same-type scalar. Binary's bf16 and f16-with-f32-scalar paths were also accepted by the API but never tested end to end; no test config used them. This PR gives trinary the same support as binary and tests all six combinations for both ops. Stacked on the elementwise-test refactor PR; retarget to
developafter it merges.ISSUE ID : AIHIPTENS-589
Technical Details
Library
hiptensor_elementwise_trinary.cpp: the type table adds{16F,16F,16F,32F},{16BF,16BF,16BF,16BF}and{16BF,16BF,16BF,32F}(typeA, typeB, typeC, typeScalar), matching binary.hiptensorElementwiseTrinaryExecutenow returnsHIPTENSOR_STATUS_NOT_SUPPORTEDwhen D's data type differs from C's, as binary already does. Previously the mismatch failed later withHIPTENSOR_STATUS_INTERNAL_ERROR.elementwise_trinary_solution_rank{2..6}_half_instances.cpp: registerck::Tuple<bhalf_t, bhalf_t, bhalf_t>alongside half, as the binary half files already do.HiptensorBinaryOpandUnaryCombinedOpthat binary bf16 already compiles with.readVal<float>, which handles a bf16 compute descriptor since feat(hiptensor): add bf16 support for elementwise permute #14406.Tests
Binary and trinary harnesses:
checkDeviceaccepts bf16 (gated onisF16Supported()). Scalar writes, comparison and printing already go through the type-dispatch helper from the refactor PR.Configs, binary and trinary, ranks 2-6:
validation/quick,emulation/quick[16BF,16BF]validation/standard,emulation/full,bench[16F,32F],[16BF,16BF],[16BF,32F]validation/comprehensiveandvalidation/fullstay empty for these ops, as before.elementwise_cpu_test: three new cases each for binary and trinary: bf16, bf16 with an f32 scalar, and f16 with an f32 scalar. The shared helpers use explicit casts so they compile forhip_bfloat16; f32 and f16 values are unchanged.elementwise_mode_test:TrinaryWithMismatchedOutputTypeReturnsNotSupported. It uses f16 for D so it runs on GPUs without FP64.Docs
api-reference.rst: the old "Element-wise Operations" rows (f16 / f32 / -etc.) are replaced by one "Element-wise (Permutation, binary, trinary)" group. All three ops now support the same six combinations. A new note says that for element-wise ops all tensors share one data type and the compute type is the scalar type.installation.rst: binary and trinary test descriptions include bfloat16.CHANGELOG.md(2.6.0): Added (trinary bf16, and f16 with an f32 scalar); Changed (trinary output-type check).TESTING.md: binary, trinary, CPU-reference and mode-test rows updated; the "binary BF16 untested" known gap removed.Test Plan
Built with
-DGPU_TARGETS=<arch>and run on real hardware:ctest -R 'elementwise|util_test'(21 tests).elementwise_cpu_testandelementwise_mode_testdirectly.validation/standard) config, counting validated cases per type pair.emulation/fullandbenchconfigs (bench with validation off).Test Result
elementwise_cpu_testelementwise_mode_testSubmission Checklist