Skip to content

xls/jit: Synthesize llvm::DataLayout from TargetLayoutInfo on demand. - #5557

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1029357972
Draft

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1029357972

Conversation

@copybara-service

Copy link
Copy Markdown

xls/jit: Synthesize llvm::DataLayout from TargetLayoutInfo on demand.

JitRuntime previously stored a copy of the target llvm::DataLayout solely for the deprecated JitRuntime::data_layout() accessor, which crashed on AOT runtimes constructed from TargetLayoutInfo and could not be inlined into callers to retire the accessor.

Add DataLayoutFromTargetLayoutInfo and have JitRuntime::data_layout() (ABSL_DEPRECATE_AND_INLINE()) return a synthesized llvm::DataLayout by value on both JIT and AOT runtimes instead of storing one in JitRuntime. Because TargetLayoutInfo captures only XLS-relevant alignment and endianness rules, non-XLS llvm::DataLayout properties (pointer, float, vector, and mangling specs) use defaults while LlvmTypeConverter and struct-layout queries on XLS types match the target layout.

`JitRuntime` previously stored a copy of the target `llvm::DataLayout` solely for the deprecated `JitRuntime::data_layout()` accessor, which crashed on AOT runtimes constructed from `TargetLayoutInfo` and could not be inlined into callers to retire the accessor.

Add `DataLayoutFromTargetLayoutInfo` and have `JitRuntime::data_layout()` (`ABSL_DEPRECATE_AND_INLINE()`) return a synthesized `llvm::DataLayout` by value on both JIT and AOT runtimes instead of storing one in `JitRuntime`. Because `TargetLayoutInfo` captures only XLS-relevant alignment and endianness rules, non-XLS `llvm::DataLayout` properties (pointer, float, vector, and mangling specs) use defaults while `LlvmTypeConverter` and struct-layout queries on XLS types match the target layout.

PiperOrigin-RevId: 1029357972

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant