Repository navigation
Add ILLink file for ComputeSharp configuration - #532
Conversation
|
Diffs:
Total: -68 KB (-4%), I'll take it! 🚀 |
This is needed to ensure ILLink can trim them as expected
This uses the same setup as the built-in runtime switches
b4edcbd to
33f01c2
Compare
| <method signature="System.Boolean get_IsDeviceRemovedExtendedDataEnabled()" body="stub" value="false" feature="COMPUTESHARP_ENABLE_DEVICE_REMOVED_EXTENDED_DATA" featurevalue="false"/> | ||
| <method signature="System.Boolean get_IsDeviceRemovedExtendedDataEnabled()" body="stub" value="true" feature="COMPUTESHARP_ENABLE_DEVICE_REMOVED_EXTENDED_DATA" featurevalue="true"/> | ||
|
|
||
| <!-- COMPUTESHARP_DISABLE_GPU_TIMEOUT switch --> |
There was a problem hiding this comment.
How about inverting the switch name to ENABLE_GPU_TIMEOUT?
There was a problem hiding this comment.
Yeah I was thinking the same as well to avoid the double negation, just figured I'd do that in a separate PR since that's technically unrelated from making the feature switches trimmable. Good point though! 👍
EDIT: fixed by #534 🙂
| <method signature="System.Boolean get_IsDebugOutputEnabled()" body="stub" value="false" feature="COMPUTESHARP_ENABLE_DEBUG_OUTPUT" featurevalue="false"/> | ||
| <method signature="System.Boolean get_IsDebugOutputEnabled()" body="stub" value="true" feature="COMPUTESHARP_ENABLE_DEBUG_OUTPUT" featurevalue="true"/> |
There was a problem hiding this comment.
I think it would be better to substitute the properties only in the case it would result in more code getting trimmed, which here is false.
If debug output is enabled the linker should not bake it into the compiled assembly, but instead the assembly should still support toggling it at runtime through the host configuration.
There was a problem hiding this comment.
Just so I understand this better, why? Is this like a general guideline? Is it just that if you're enabling additional options it means you're already given up speed so it's not worth it to trim more, or something else? 🤔
There was a problem hiding this comment.
The way I see it, you want to support removing the debug-related code which means that you want to hardcode disabling debug output. If debug output is not hardcoded to be off, whether to use it will be decided at runtime.
it's not worth it to trim more
What would be trimmed if debug output was hardcoded to be enabled? RuntimeFeature.IsDynamicCode*** can be hardcoded to either true or false, but this can actually trim a compiled or interpreted implementation. What would be the benefit here?
Description
This PR adds an ILLink configuration file to trim the configuration flags (same as terrafx/terrafx.interop.windows#341). For some reason though this doesn't seem to be working — I'm getting the same exact 1.715 KB binary when building the CLI sample with NativeAOT on .NET 7 both with these changes, and removing that embedded resource entirely 🤔
@tannergooding @MichalStrehovsky am I missing something obvious here? 😅