Skip to content

feat: towards support for globals - #1139

Merged
math-fehr merged 11 commits into
mainfrom
regehr/globals1
Jul 29, 2026
Merged

feat: towards support for globals#1139
math-fehr merged 11 commits into
mainfrom
regehr/globals1

Conversation

@regehr

@regehr regehr commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

this PR registers mlir__global and mlir__addressof, and then follows through with other code supporting this such as verifier support

the short-term goal (not nearly achieved yet) is to run Test/LLVM/global_load_store.mlir though the veir interpreter. this test simple loads from an i32 global, increments the value, and uses the result to store back to the global and also returns it from main().

@regehr regehr self-assigned this Jul 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VeIR Benchmarks

Details
Benchmark suite Current: 171e279 Previous: e995cda Ratio
add-fold-worklist/create 1900000 ns (± 110274) 2266000 ns (± 118215) 0.84
add-fold-worklist/rewrite 3832500 ns (± 59435) 4192500 ns (± 63611) 0.91
add-fold-worklist-local/create 1925000 ns (± 48680) 2301000 ns (± 113070) 0.84
add-fold-worklist-local/rewrite 4671000 ns (± 70163) 5204000 ns (± 184667) 0.90
add-zero-worklist/create 2028500 ns (± 91143) 2257000 ns (± 98643) 0.90
add-zero-worklist/rewrite 2753500 ns (± 41289) 3009000 ns (± 28429) 0.92
add-zero-reuse-worklist/create 1581000 ns (± 23249) 1914000 ns (± 75035) 0.83
add-zero-reuse-worklist/rewrite 2386000 ns (± 25851) 2678000 ns (± 93937) 0.89
mul-two-worklist/create 1918000 ns (± 99760) 2234500 ns (± 112485) 0.86
mul-two-worklist/rewrite 5368500 ns (± 156944) 5918000 ns (± 161062) 0.91
add-fold-forwards/create 1922000 ns (± 86875) 2290000 ns (± 72400) 0.84
add-fold-forwards/rewrite 2713000 ns (± 32334) 3012000 ns (± 11606) 0.90
add-zero-forwards/create 1898000 ns (± 80315) 2343000 ns (± 112877) 0.81
add-zero-forwards/rewrite 1732000 ns (± 25446) 2007000 ns (± 68057) 0.86
add-zero-reuse-forwards/create 1554000 ns (± 17326) 1893000 ns (± 85786) 0.82
add-zero-reuse-forwards/rewrite 1390000 ns (± 16053) 1563000 ns (± 34470) 0.89
mul-two-forwards/create 1902000 ns (± 97085) 2233000 ns (± 94401) 0.85
mul-two-forwards/rewrite 3333000 ns (± 103331) 3673000 ns (± 187633) 0.91
add-zero-reuse-first/create 1582000 ns (± 54048) 1888000 ns (± 56993) 0.84
add-zero-reuse-first/rewrite 9000 ns (± 0) 8000 ns (± 0) 1.13
add-zero-lots-of-reuse-first/create 1581500 ns (± 68888) 2002000 ns (± 58122) 0.79
add-zero-lots-of-reuse-first/rewrite 770000 ns (± 38335) 830000 ns (± 25205) 0.93

This comment was automatically generated by workflow using github-action-benchmark.

@math-fehr math-fehr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I think I only have one two comments that should be addressed, the rest is comments where we should probably create an issue about it and fix it later.

Comment thread Test/LLVM/addressof_invalid_result.mlir
Comment thread Veir/Verifier.lean
Comment thread Veir/Verifier.lean
Comment thread Veir/Verifier.lean
Comment thread Veir/Verifier.lean Outdated
@regehr
regehr marked this pull request as draft July 28, 2026 14:44
@regehr
regehr marked this pull request as ready for review July 29, 2026 04:13
@regehr

regehr commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

@math-fehr comments addressed and code improved, ready for another quick look, thanks!

@math-fehr
math-fehr added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit bfa856e Jul 29, 2026
5 checks passed
@math-fehr
math-fehr deleted the regehr/globals1 branch July 29, 2026 23:58
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.

2 participants