Skip to content

Add AIR compatibility#2934

Open
pw0908 wants to merge 9 commits into
EnzymeAD:mainfrom
pw0908:metal-air-math-intrinsics
Open

Add AIR compatibility#2934
pw0908 wants to merge 9 commits into
EnzymeAD:mainfrom
pw0908:metal-air-math-intrinsics

Conversation

@pw0908

@pw0908 pw0908 commented Jul 8, 2026

Copy link
Copy Markdown

@pw0908

pw0908 commented Jul 9, 2026

Copy link
Copy Markdown
Author

@wsmoses Looks like most tests passed. The ones that failed seem to have failed due to air.atan2.f32. Is that a function that is supported normally anyways?

// module. Rather than depend on that, these get dedicated blocks so the
// AIR-named companion (e.g. air.cosh.f32) is created directly on demand,
// regardless of what else is present in the module.
def : CallPattern<(Op $x),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You are missing air.atan2.f32. here?

@wsmoses

wsmoses commented Jul 14, 2026

Copy link
Copy Markdown
Member

clang format fails.

also @pw0908 for correctness you'll also likely need to add metal to the list of uses like

Arch == Triple::amd_target;

Comment thread enzyme/Enzyme/Enzyme.cpp Outdated

bool AtomicAdd = Arch == Triple::nvptx || Arch == Triple::nvptx64 ||
Arch == Triple::amdgcn;
Arch == Triple::amdgcn || TT.getArchName() == "air64";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Look for all uses of amd_target / amdgcn in the codebase, I think this needs to be applied more broadly. Perhaps a helper function in utils.h for all gpu arch's would be useful?

@wsmoses

wsmoses commented Jul 15, 2026

Copy link
Copy Markdown
Member

ci shows this fails to build

// thread-id/barrier codegen below only knows how to handle
// NVPTX and AMDGPU (it is unreachable for any other arch, e.g.
// Metal air64).
if ((Arch == Triple::nvptx || Arch == Triple::nvptx64 ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this shouldn't be intentional, it should actually do isGPUArch && g.getType()->getAddressSpace() == getGPUSharedAddrSpace(TT)

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