This is an archive of the discontinued LLVM Phabricator instance.

Add SymbolRefAttr to python bindings
ClosedPublic

Authored by makslevental on Jul 5 2023, 1:03 PM.

Diff Detail

Event Timeline

makslevental created this revision.Jul 5 2023, 1:03 PM
Herald added a project: Restricted Project. · View Herald Transcript

use MlirAttribute instead

add AttrBuilder.get('SymbolNameAttr') test

makslevental published this revision for review.Jul 5 2023, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 1:26 PM
rkayaith added inline comments.Jul 5 2023, 2:06 PM
mlir/lib/Bindings/Python/IRAttributes.cpp
452

should this be removed from the CAPI, since it's not a unique typeid? (similar to how BoolAttr doesn't have its typeid exposed)

460–488

not sure trying to parse @/::s here is a good idea, as far as I know they're valid characters in symbol names:

module @"@foo::bar" {}  // no complaints from the verifier

better to leave it to Attribute.parse to handle all that imo

510–518

Doesn't str() effectively do this already, since it prints the asm string? I would return List[str] here instead.

makslevental marked 2 inline comments as done.Jul 5 2023, 2:32 PM
makslevental added inline comments.
mlir/lib/Bindings/Python/IRAttributes.cpp
460–488

fair enough

don't parse

handle degenerate case in python rather than cpp

rkayaith accepted this revision.Jul 5 2023, 3:32 PM
rkayaith added inline comments.
mlir/test/python/ir/attributes.py
248–252

nit: default_get is used in both of these prints, can you change one of them

This revision is now accepted and ready to land.Jul 5 2023, 3:32 PM
This revision was automatically updated to reflect the committed changes.