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

Add intrinsic support for atomic operations. #1628

Merged
merged 12 commits into from
Dec 24, 2024
Merged

Conversation

lucteo
Copy link
Contributor

@lucteo lucteo commented Dec 2, 2024

Add intrinsic support for atomic store and load, atomic Read-Modify-Write, CompareExchange and fence operations.

Also add `void` intrinsic type.
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 85.76419% with 163 lines in your changes missing coverage. Please review.

Project coverage is 88.34%. Comparing base (734e7be) to head (a3fd992).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
Sources/CodeGen/LLVM/Transpilation.swift 60.29% 162 Missing ⚠️
Sources/FrontEnd/BuiltinFunction.swift 99.61% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1628      +/-   ##
==========================================
- Coverage   88.44%   88.34%   -0.11%     
==========================================
  Files         381      381              
  Lines       30359    31503    +1144     
==========================================
+ Hits        26851    27830     +979     
- Misses       3508     3673     +165     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lucteo lucteo changed the title Add intrinsic support for atomic store and load. Add intrinsic support for atomic operations. Dec 8, 2024
Copy link
Contributor

@kyouko-taiga kyouko-taiga left a comment

Choose a reason for hiding this comment

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

I strongly suspect that we can find a simpler way to represent the types of non-returning instructions. What if we say that the return type of a built-in instruction is an enum:

enum BuiltinReturnType {
  case builtin(BuiltinType)
  case void
}

I'll try to propose another implementation ASAP.

@kyouko-taiga kyouko-taiga self-requested a review December 23, 2024 13:54
Copy link
Contributor

@kyouko-taiga kyouko-taiga left a comment

Choose a reason for hiding this comment

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

Looks good mostly. Would be nice if we had more tests covering code generation.

@lucteo
Copy link
Contributor Author

lucteo commented Dec 24, 2024

Thank you very much, will add more tests in a follow-up PR.

@lucteo lucteo merged commit 6ed2f86 into main Dec 24, 2024
14 of 16 checks passed
@lucteo lucteo deleted the atomics_store_load_intrinsics branch December 24, 2024 12:24
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