This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Properly handle NativeCodeCallVoid in result patterns.
AbandonedPublic

Authored by jcai19 on Sep 8 2023, 1:38 PM.

Details

Reviewers
jpienaar
Summary

Currently NativeCodeCallVoid is not supported in the result patterns.
For example, below code will fail to build with the error message
referencing unbound symbol.

def Foo: NativeCodeCallVoid<"foo()">;

def AddToAddV2 : Pattern<
  (TF_AddOp TF_NumberTensor:$arg0, TF_NumberTensor:$arg1),
  [(TF_AddV2Op $arg0, $arg1), (Foo)]>;

MLIR tablegen-based pattern rewrites does not preserve attributes of the source
op, with this change users could mannualy copy source attributes to the target
op via NativeCodeCallVoid. This is a replacement of D157032.

Diff Detail

Event Timeline

jcai19 created this revision.Sep 8 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2023, 1:38 PM
jcai19 requested review of this revision.Sep 8 2023, 1:38 PM
jcai19 edited the summary of this revision. (Show Details)Sep 8 2023, 1:50 PM
jcai19 added a reviewer: jpienaar.
jcai19 edited the summary of this revision. (Show Details)
jcai19 edited the summary of this revision. (Show Details)
jcai19 edited the summary of this revision. (Show Details)
jcai19 abandoned this revision.Sep 8 2023, 2:05 PM

Pull request created at https://github.com/llvm/llvm-project/pull/65804 per the new policy.