Skip to content

[LinalgExt] Added toggle for using useExp2 for onlineAttention Decomposition#23211

Merged
Groverkss merged 12 commits intoiree-org:mainfrom
keshavvinayak01:users/keshavvinayak01/onlineattention-useexp2-toggle-clean
Jan 20, 2026
Merged

[LinalgExt] Added toggle for using useExp2 for onlineAttention Decomposition#23211
Groverkss merged 12 commits intoiree-org:mainfrom
keshavvinayak01:users/keshavvinayak01/onlineattention-useexp2-toggle-clean

Conversation

@keshavvinayak01
Copy link
Contributor

@keshavvinayak01 keshavvinayak01 commented Jan 20, 2026

Following the discussion from #22441

Depending on the backend, certain computations may benefit from directly using exp instead of exp2, since there might be accuracy losses due to FP-reassociation. It's helpful to add flag incase the user tracks losses to this particular computation and might favour directly using exp.

The use_exp2 flag is mostly unused in dialect conversions and passes, I presume it's used as a KernelOption. The changes here will not modify the default behavior.

@keshavvinayak01 keshavvinayak01 changed the title users/keshavvinayak01/onlineattention useexp2 toggle clean [LinalgExt] Added toggle for using useExp2 for onlineAttention Decomposition Jan 20, 2026
keshavvinayak01 and others added 11 commits January 20, 2026 05:59
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
…dd use_exp2 not overwrite

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Updated computeSubAndExp2 calls to computeSubAndExp with useExp2 flag.

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
@keshavvinayak01 keshavvinayak01 force-pushed the users/keshavvinayak01/onlineattention-useexp2-toggle-clean branch from 33af3f6 to 56e0617 Compare January 20, 2026 06:00
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
@Groverkss Groverkss merged commit 9753465 into iree-org:main Jan 20, 2026
80 of 82 checks passed
@amd-eochoalo
Copy link
Contributor

amd-eochoalo commented Jan 20, 2026

@keshavvinayak01 This PR appears to break the windows build https://github.com/iree-org/iree/actions/runs/21179744109/job/60918483815 can you take a look?

@amd-eochoalo
Copy link
Contributor

amd-eochoalo commented Jan 20, 2026

C:\home\runner_work\iree\iree\compiler\src\iree\compiler\Dialect\LinalgExt\IR\AggregatedOpInterfaceImpl.cpp(285): error C2446: ':': no conversion from 'mlir::math::ExpOp' to 'mlir::math::Exp2Op'
C:\home\runner_work\iree\iree\compiler\src\iree\compiler\Dialect\LinalgExt\IR\AggregatedOpInterfaceImpl.cpp(285): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

@keshavvinayak01
Copy link
Contributor Author

Can solve this with a single line of change. I'll send a PR soon.

@keshavvinayak01
Copy link
Contributor Author

@amd-eochoalo #23219

amd-eochoalo pushed a commit that referenced this pull request Jan 20, 2026
…mpl (#23219)

The original code returns two types, and MSVC refuses to pick a common
type. By switching the conditional to return a Value, the types are
identical, so MSVC should accept it.

Solves the CI bug raised by #23211

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
keshavvinayak01 added a commit that referenced this pull request Jan 27, 2026
…osition (#23211)

Following the discussion from
#22441

Depending on the backend, certain computations may benefit from directly
using `exp` instead of `exp2`, since there might be accuracy losses due
to FP-reassociation. It's helpful to add flag incase the user tracks
losses to this particular computation and might favour directly using
`exp`.

The `use_exp2` flag is mostly unused in dialect conversions and passes,
I presume it's used as a KernelOption. The changes here will not modify
the default behavior.

---------

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
keshavvinayak01 added a commit that referenced this pull request Jan 27, 2026
…mpl (#23219)

The original code returns two types, and MSVC refuses to pick a common
type. By switching the conditional to return a Value, the types are
identical, so MSVC should accept it.

Solves the CI bug raised by #23211

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Feb 24, 2026
…osition (iree-org#23211)

Following the discussion from
iree-org#22441

Depending on the backend, certain computations may benefit from directly
using `exp` instead of `exp2`, since there might be accuracy losses due
to FP-reassociation. It's helpful to add flag incase the user tracks
losses to this particular computation and might favour directly using
`exp`.

The `use_exp2` flag is mostly unused in dialect conversions and passes,
I presume it's used as a KernelOption. The changes here will not modify
the default behavior.

---------

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Feb 24, 2026
…mpl (iree-org#23219)

The original code returns two types, and MSVC refuses to pick a common
type. By switching the conditional to return a Value, the types are
identical, so MSVC should accept it.

Solves the CI bug raised by iree-org#23211

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha@gmail.com>
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