This is an archive of the discontinued LLVM Phabricator instance.

[X86][AMX] support amxpreserve attribute in llvm.
Needs ReviewPublic

Authored by LuoYuanke on Dec 6 2021, 4:20 PM.

Details

Summary

Introduce 'amxpreserve' attribute to reduce save/restore AMX register
in register allocation.
Use this attribute to indicate that the specified function has no
caller-saved AMX registers. Compiler doesn't save and restore any
AMX register across function call. It is user's responsibility that
ensure there is no AMX register clobber in the function with "amxpreserve"
attribute.

Like 'no_caller_saved_registers', 'amxpreserve' attribute is not a
calling convention. In fact, it only overrides the decision of which
AMX registers should be saved by the caller.

For example:

.. code-block:: c

  __attribute__ ((amxpreserve ))
  void f () {
    ...
  }

  void bar () {
    ...
    f();
    ...
  }

In this case compiler doesn't save and restore AMX registers across the
call of f().

Diff Detail

Event Timeline

LuoYuanke created this revision.Dec 6 2021, 4:20 PM
LuoYuanke requested review of this revision.Dec 6 2021, 4:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2021, 4:20 PM
jdoerfert requested changes to this revision.Dec 7 2021, 1:19 AM

Problems: no commit message, no RFC?, no lang ref update.

This revision now requires changes to proceed.Dec 7 2021, 1:19 AM

Problems: no commit message, no RFC?, no lang ref update.

This is just for communication. I'll refine the patch and ask LLVM folks for review.

Problems: no commit message, no RFC?, no lang ref update.

This is just for communication. I'll refine the patch and ask LLVM folks for review.

That's fine. Please mark such patches as [WIP] or with a clear note in the commit message, or both.

LuoYuanke retitled this revision from [X86][AMX] support amxpreserve attribute in llvm. to [WIP][X86][AMX] support amxpreserve attribute in llvm..Dec 7 2021, 4:14 AM

That's fine. Please mark such patches as [WIP] or with a clear note in the commit message, or both.

Thanks for the suggestion. Done.

LuoYuanke retitled this revision from [WIP][X86][AMX] support amxpreserve attribute in llvm. to [X86][AMX] support amxpreserve attribute in llvm..Dec 8 2021, 7:46 PM
LuoYuanke edited the summary of this revision. (Show Details)

@jdoerfert, It is ready for review now.

LuoYuanke updated this revision to Diff 393647.Dec 10 2021, 6:29 PM

update commit message.

This needs a lang ref update and an RFC. If they exist, add links to them in the commit message.

ormris removed a subscriber: ormris.Jan 18 2022, 4:25 PM