Thread overview
Controlling SIMD codegen on a module by module basis?
Jan 07, 2024
claptrap
Jan 07, 2024
Johan
Jan 07, 2024
claptrap
January 07, 2024

Say you support no-SSE, SSE or AVX and you want to pick which to use at runtime. Is there a way to tell the optimizer not to use AVX, or SEE on a given module? Like set "-mattr" on a module by module basis?

January 07, 2024

On Sunday, 7 January 2024 at 10:48:47 UTC, claptrap wrote:

>

Say you support no-SSE, SSE or AVX and you want to pick which to use at runtime. Is there a way to tell the optimizer not to use AVX, or SEE on a given module? Like set "-mattr" on a module by module basis?

You can use @ldc.attributes.target for this.
https://wiki.dlang.org/LDC-specific_language_changes#.40.28ldc.attributes.target.28.22feature.22.29.29

cheers,
Johan

January 07, 2024

On Sunday, 7 January 2024 at 12:08:17 UTC, Johan wrote:

>

On Sunday, 7 January 2024 at 10:48:47 UTC, claptrap wrote:

>

Say you support no-SSE, SSE or AVX and you want to pick which to use at runtime. Is there a way to tell the optimizer not to use AVX, or SEE on a given module? Like set "-mattr" on a module by module basis?

You can use @ldc.attributes.target for this.
https://wiki.dlang.org/LDC-specific_language_changes#.40.28ldc.attributes.target.28.22feature.22.29.29

cheers,
Johan

thanks