This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Check exact width in get*ClassForBitWidth
AbandonedPublic

Authored by foad on Feb 16 2023, 8:47 AM.

Details

Reviewers
arsenm
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

foad created this revision.Feb 16 2023, 8:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 8:47 AM
foad requested review of this revision.Feb 16 2023, 8:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 8:47 AM
foad added reviewers: Restricted Project, arsenm.Feb 16 2023, 8:51 AM

This is an RFC to check my intuition that we really want exact matches here - there should not be any cases where we return a wider class than was asked for. In particular, we have SGPR classes corresponding to every VGPR class width.

Currently this causes a couple of test failures:

LLVM :: CodeGen/AMDGPU/GlobalISel/extractelement.ll
LLVM :: CodeGen/AMDGPU/GlobalISel/insertelement.ll

The failure mode is like:

LLVM ERROR: cannot select: %29:sreg_32(s32), %30:sreg_32(s32), %31:sreg_32(s32), %32:sreg_32(s32), %33:sreg_32(s32), %34:sreg_32(s32), %35:sreg_32(s32), %36:sreg_32(s32), %37:sreg_32(s32), %38:sreg_32(s32), %39:sreg_32(s32), %40:sreg_32(s32), %41:sreg_32(s32), %42:sreg_32(s32) = G_UNMERGE_VALUES %28:sgpr(<7 x s64>) (in function: dyn_insertelement_v7f64_s_s_s)

I guess this a globalisel legalization problem. We don't have any 448-bit register classes corresponding to the <7 x s64> on the RHS of this instruction, so maybe legalization should have widened it to <8 x s64>?

arsenm accepted this revision.Feb 16 2023, 9:08 AM

LGTM. I think only the <= case would make sense to handle 16/32

This revision is now accepted and ready to land.Feb 16 2023, 9:08 AM
foad planned changes to this revision.Apr 24 2023, 6:43 AM

Currently this causes a couple of test failures:

LLVM :: CodeGen/AMDGPU/GlobalISel/extractelement.ll
LLVM :: CodeGen/AMDGPU/GlobalISel/insertelement.ll

This patch will probably be superseded by D148096 which aims to fix those failures.

foad abandoned this revision.Aug 7 2023, 6:07 AM

This patch will probably be superseded by D148096 which aims to fix those failures.

Yup, superseded.