Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of llvm::StringLiteral for string literals is a cause of relocations #19529

Open
bjacob opened this issue Dec 19, 2024 · 1 comment
Open
Assignees
Labels
cleanup 🧹 performance ⚡ Performance/optimization related work across the compiler and runtime

Comments

@bjacob
Copy link
Contributor

bjacob commented Dec 19, 2024

We discussed this theoretically in #19440 (comment), but now here's experimental proof:

ninja iree-opt && readelf -WCr ./lib/libIREECompiler.so 2>/dev/null | grep ' contains '

At current main branch (ed9a028d3), x86-64, RelWithDebInfo build:

Relocation section '.rela.dyn' at offset 0x1274108 contains 484355 entries:
Relocation section '.rela.plt' at offset 0x1d8a150 contains 47171 entries:

With the below diff applied:

Relocation section '.rela.dyn' at offset 0x1274108 contains 484354 entries:
Relocation section '.rela.plt' at offset 0x1d8a138 contains 47171 entries:
diff --git a/compiler/src/iree/compiler/Codegen/Common/MaterializeUserConfigs.cpp b/compiler/src/iree/compiler/Codegen/Common/MaterializeUserConfigs.cpp
index 92e719b76d..3bfe455390 100644
--- a/compiler/src/iree/compiler/Codegen/Common/MaterializeUserConfigs.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/MaterializeUserConfigs.cpp
@@ -172,7 +172,7 @@ struct MaterializeUserConfigsPass final
       if (succeeded(getModuleTuningSpec(moduleOp, tuningSpec))) {
         assert(tuningSpec);
         userTransformLibrary = TransformLibraryWithEntrypoint{
-            tuningSpec.get(), kKernelConfigSpecName.str()};
+            tuningSpec.get(), kKernelConfigSpecName};
       }
     }
 
diff --git a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h
index 59bf10a71a..e73945278c 100644
--- a/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h
+++ b/compiler/src/iree/compiler/Codegen/Dialect/Codegen/IR/IREECodegenAttrs.h
@@ -49,7 +49,7 @@ constexpr StringLiteral kTuningSpecEntrypointAttrName =
     "iree_codegen.tuning_spec_entrypoint";
 constexpr StringLiteral kSerializedTuningSpecAttrName =
     "iree_codegen.tuning_spec_mlirbc";
-constexpr StringLiteral kKernelConfigSpecName = "__kernel_config";
+constexpr char kKernelConfigSpecName[] = "__kernel_config";
@bjacob bjacob added cleanup 🧹 performance ⚡ Performance/optimization related work across the compiler and runtime labels Dec 19, 2024
@benvanik
Copy link
Collaborator

oof, that sucks - longer to link, longer to load!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 performance ⚡ Performance/optimization related work across the compiler and runtime
Projects
None yet
Development

No branches or pull requests

3 participants