[Mlir-commits] [mlir] [mlir][ArmSME] Make use of backend function attributes for enabling ZA storage (PR #71044)
Cullen Rhodes
llvmlistbot at llvm.org
Fri Nov 10 06:16:51 PST 2023
================
@@ -48,46 +49,39 @@ namespace arm_sme {
using namespace mlir;
using namespace mlir::arm_sme;
+namespace {
-static constexpr char kArmStreamingAttr[] = "arm_streaming";
-static constexpr char kArmLocallyStreamingAttr[] = "arm_locally_streaming";
-static constexpr char kArmZAAttr[] = "arm_za";
-static constexpr char kEnableArmStreamingIgnoreAttr[] =
- "enable_arm_streaming_ignore";
+constexpr StringLiteral
+ kEnableArmStreamingIgnoreAttr("enable_arm_streaming_ignore");
-namespace {
struct EnableArmStreamingPass
: public arm_sme::impl::EnableArmStreamingBase<EnableArmStreamingPass> {
- EnableArmStreamingPass(ArmStreaming mode, bool enableZA) {
- this->mode = mode;
- this->enableZA = enableZA;
+ EnableArmStreamingPass(ArmStreamingMode streamingMode, ArmZaMode zaMode) {
+ this->streamingMode = streamingMode;
+ this->zaMode = zaMode;
}
void runOnOperation() override {
- if (getOperation()->getAttr(kEnableArmStreamingIgnoreAttr))
+ auto op = getOperation();
+ if (op->getAttr(kEnableArmStreamingIgnoreAttr))
return;
- StringRef attr;
- switch (mode) {
- case ArmStreaming::Default:
- attr = kArmStreamingAttr;
- break;
- case ArmStreaming::Locally:
- attr = kArmLocallyStreamingAttr;
- break;
- }
- getOperation()->setAttr(attr, UnitAttr::get(&getContext()));
+ auto unitAttr = UnitAttr::get(&getContext());
+
+ if (streamingMode == ArmStreamingMode::Disabled)
+ return;
----------------
c-rhodes wrote:
nit: move above `unitAttr` or incorporate into top if
https://github.com/llvm/llvm-project/pull/71044
More information about the Mlir-commits
mailing list