Skip to content

Conversation

@eduardosm
Copy link
Contributor

It is needed because cargo features are additive. Given a situation where you have two dependencies:

  • One depends on cranelift aarch64 codegen, so it enables the aarch64 feature.
  • The other depends on cranelift native codegen, so it does not enable any arch feature.

Given the additive property of features, cranelift-codegen will be built with the aarch64 feature for both dependencies (assuming they use the same cranelift version), so the native ISA will not be included (unless it is aarch64).

With the host-arch feature added here, the native host ISA can now be explicitly requested without risk of another crate of the dependency tree disabling it.

The native ISA is still enabled when none is explicitly enabled, although I think that this behaviour should be deprecated.

@eduardosm eduardosm requested a review from a team as a code owner June 9, 2023 17:54
@eduardosm eduardosm requested review from elliottt and removed request for a team June 9, 2023 17:54
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jun 9, 2023
Copy link
Member

@elliottt elliottt left a comment

Choose a reason for hiding this comment

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

This makes sense to me, thanks for the great explanation!

It is needed because cargo features are additive. Given a situation where you have two dependencies:

* One depends on cranelift aarch64 codegen, so it enables the `aarch64` feature.
* The other depends on cranelift native codegen, so it does not enable any arch feature.

Given the additive property of features, cranelift-codegen will be built with the `aarch64` feature for both dependencies (assuming they use the same cranelift version), so the native ISA will not be included (unless it is aarch64).

With the `host-arch` feature added here, the native host ISA can now be explicitly requested without risk of another crate of the dependency tree disabling it.
@alexcrichton alexcrichton added this pull request to the merge queue Jun 21, 2023
Merged via the queue into bytecodealliance:main with commit b7b8478 Jun 21, 2023
@eduardosm eduardosm deleted the explicit-host-isa branch June 21, 2023 16:25
salewski pushed a commit to salewski/wasmtime that referenced this pull request Jun 30, 2023
…ecodealliance#6551)

It is needed because cargo features are additive. Given a situation where you have two dependencies:

* One depends on cranelift aarch64 codegen, so it enables the `aarch64` feature.
* The other depends on cranelift native codegen, so it does not enable any arch feature.

Given the additive property of features, cranelift-codegen will be built with the `aarch64` feature for both dependencies (assuming they use the same cranelift version), so the native ISA will not be included (unless it is aarch64).

With the `host-arch` feature added here, the native host ISA can now be explicitly requested without risk of another crate of the dependency tree disabling it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants