Skip to content

common: postops: add post-ops support for binary select op #2900

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

avmanerikar
Copy link
Contributor

@avmanerikar avmanerikar commented Mar 17, 2025

Description

The PR adds updates post-ops implementations so that they support binary select operation as a post-op:

$dst[i] = cond[i]\quad?\quad src_0[i] \quad:\quad src_1[i]$

The updates account for the third conditional input that the select op requires for computation.

Implements MFDNN-12883.

This also introduces a new benchdnn format for providing arguments to multiple src tensors for a single post-op:

--attr-post-ops=select:DT[.S1_MASK_INPUT[.S1_TAG]][:S2_MASK_INPUT[.S2_TAG]]

Testcase:

./benchdnn --matmul --attr-post-ops=select:f32.per_tensor.ab:per_tensor.ab 5x10:10x5

(Currently, there is no broadcasting support for the conditional src2 tensor. The data type, mask policy and tag for the src2 tensor are fixed as s8, common and any respectively).

@avmanerikar avmanerikar requested review from a team as code owners March 17, 2025 16:07
@github-actions github-actions bot added documentation A request to change/fix/improve the documentation. Codeowner: @oneapi-src/onednn-doc platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64 platform:gpu-intel Codeowner: @oneapi-src/onednn-gpu-intel platform:gpu-generic Codeowner: @oneapi-src/onednn-gpu-generic component:api Codeowner: @oneapi-src/onednn-arch component:tests Codeowner: @oneapi-src/onednn-arch labels Mar 17, 2025
@avmanerikar avmanerikar changed the title cpu: binary: add post-ops support for binary select op common: postops: add post-ops support for binary select op Mar 17, 2025
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 20dff17 to 7edca7d Compare March 21, 2025 23:28
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 7edca7d to 43a333b Compare March 31, 2025 15:43
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch 2 times, most recently from 5dc4c66 to 9a186cc Compare April 2, 2025 20:06
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch 2 times, most recently from 4430430 to 6b34aa8 Compare April 3, 2025 21:08
@avmanerikar avmanerikar requested a review from a team as a code owner April 3, 2025 21:08
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 6b34aa8 to 4dad525 Compare April 5, 2025 01:26
@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 4dad525 to b87f40b Compare April 7, 2025 08:10
@avmanerikar
Copy link
Contributor Author

make test
set test_scope=NIGHTLY
disable test_device_gpu

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 2eb1881 to cec796c Compare April 10, 2025 16:15
@avmanerikar
Copy link
Contributor Author

make test

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from cec796c to 0b2eb56 Compare April 14, 2025 02:19
@avmanerikar
Copy link
Contributor Author

make test

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch 4 times, most recently from 0592feb to 1495176 Compare April 19, 2025 00:48
@avmanerikar
Copy link
Contributor Author

make test

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch 2 times, most recently from 81af0ca to 1503ebc Compare April 21, 2025 21:08
@avmanerikar
Copy link
Contributor Author

make test
set test_scope=NIGHTLY
disable test_device_gpu

@avmanerikar avmanerikar requested a review from dzarukin April 22, 2025 23:29
The arguments for each tensor are provided in the form `DT.MASK_INPUT.TAG`,
with the arguments for the third tensor positioned after that of the second
and are separated by `:`. The arguments are optional for the third tensor and
the data type value for the third tensor is fixed at `s8`.
Copy link
Contributor

Choose a reason for hiding this comment

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

@ranukund, could you, please, check out this page?

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from 1503ebc to b2dd6e7 Compare April 25, 2025 00:41
@avmanerikar
Copy link
Contributor Author

make test
set test_scope=NIGHTLY
disable test_device_gpu

@avmanerikar avmanerikar force-pushed the amanerik/main/binary-select-postop-ext branch from b2dd6e7 to e0d8380 Compare April 28, 2025 15:51
@avmanerikar
Copy link
Contributor Author

make test
set test_scope=NIGHTLY
disable test_device_gpu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api Codeowner: @oneapi-src/onednn-arch component:common component:tests Codeowner: @oneapi-src/onednn-arch documentation A request to change/fix/improve the documentation. Codeowner: @oneapi-src/onednn-doc platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64 platform:gpu-generic Codeowner: @oneapi-src/onednn-gpu-generic platform:gpu-intel Codeowner: @oneapi-src/onednn-gpu-intel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants