Add @[TargetFeature] annotation#16717
Conversation
|
I don't think this resolves #3057? It doesn't really change anything about SIMD support specifically. Enabling optional codegen features applies to SIMD instructions of course. |
|
It might be nice to put some actually working examples in |
@[TargetFeature] annotation
|
This pull request has been mentioned on Crystal Forum. There might be relevant details there: https://forum.crystal-lang.org/t/rfc-0020-targetfeature-annotation/8771/1 |
|
I simplified the specs, although not really sure why test (x86_64, 1.0.0, -Dwithout_ffi, true) isn't working |
|
The Crystal 1.0 build seems to use LLVM 8 and apparently something is broken there. Can you trigger the Forward Compatibility workflow on your fork? It runs against all Crystal versions which could tell us more about which LLVM versions are supported. |
|
looks like that ran 2 days ago fine, just triggered a re-run |
|
those forward compatibility tests passed |
|
The workflow run https://github.com/stakach/crystal/actions/runs/22881295464 is based on the original commit, though. It doesn't take into account the recent changes. Could you try again triggering from the current branch head? On https://github.com/stakach/crystal/actions/workflows/forward-compatibility.yml click "Run workflow" and select |
|
I don't have the run workflow option... Hence why I re-ran it previously, was the option available to me |
|
Ah, workflow dispatch is only available when the workflow exists in the repo's default branch. If you sync EDIT: Sorry, I mean the master branch in your fork (https://github.com/stakach/crystal/tree/master) must be up-to-date with (https://github.com/crystal-lang/crystal/tree/master) so it includes the forward compatibility workflow. |
The helper compiles up to LLVM codegen for any target. Sits between the "codegen" helper that compiles up to Crystal codegen and the "run" helper that builds an executable and runs it. There aren't much use cases. The codegen/private specs are an example. #16717 could also use it.
|
not entirely sure what changes to specs are required.
|
|
I ran forward compatibility tests in https://github.com/crystal-lang/crystal/actions/runs/23340306157. It fails for Crystal versions below 1.8, all with similar messages. This coincides with an upgrade from LLVM 10 to LLVM 15, which probably makes the significant difference. FTR, this is the error message: We should probably skip Perhaps we could also consider adding an error condition in the codegen implementation. However, this would probably require a bit more investigation into the exact conditions. So maybe we just leave it as is. It only concerns old LLVM versions. |
|
As a bonus, LLVM also recently removed the 3DNow! flag, so feature flags are not guaranteed to be forward-compatible on LLVM's side. |
|
The specs can also use the new That plus pending specs for LLVM < 13 and CI should be happy. |
We must call the function for it to be compiled, otherwise it's dead code and will be skipped and always succeed. We must also specify the compilation target otherwise specs are failing once we call the function with a LLVM error.
|
I patched the codegen specs to call the function otherwise it's not compiled and the specs always succeed (oops). As expected, that triggered LLVM errors such as unknown feature or cpu for target (my host is x86_64). I specified compilation targets and it should now be good 🤞 |

fixes #16570
refs #3057
closes #16571
implements crystal-lang/rfcs#20