[Mlir-commits] [mlir] [mlir][gpu] Add innermost-first policy when mapping loops to GPU IDs (PR #160634)

Fabian Mora llvmlistbot at llvm.org
Thu Sep 25 05:46:13 PDT 2025


================
@@ -65,16 +66,29 @@ static MappingLevel &operator++(MappingLevel &mappingLevel) {
   return mappingLevel;
 }
 
+// Map the policy string to a typed mapping policy.
+static FailureOr<MappingPolicy> getMappingPolicyFromStr(StringRef policy) {
+  std::string policyCanonical = policy.trim().lower();
+
+  auto option =
+      llvm::StringSwitch<std::optional<MappingPolicy>>(policyCanonical)
----------------
fabianmcg wrote:

Policy says: 
> use auto with initializers like cast<Foo>(...) or other places where the type is already obvious from the context

I argue the type in `llvm::StringSwitch<std::optional<MappingPolicy>>`  is not immediately clear for anyone that's not familiar with `llvm::StringSwitch`, so it's better to have it explicit.

https://github.com/llvm/llvm-project/pull/160634


More information about the Mlir-commits mailing list