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

Merge with upstream #75

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Merge with upstream #75

merged 4 commits into from
Jan 9, 2024

Conversation

dhil
Copy link
Member

@dhil dhil commented Jan 9, 2024

No description provided.

alexcrichton and others added 4 commits January 8, 2024 19:11
Try not passing `-y -u` to `pacman` to avoid full system updates.
Currently full system updates might update the `msys2-runtime` package
before actually updating the package we requested, meaning that this
might not actually update anything given an update. This is what's
currently happening on CI which is breaking due to an update of gcc not
actually updating gcc. I'm mostly reading the invocation in
rust-lang/rust CI and seeing that it doesn't pass `-y -u` and hopeing
that by copying that here things might work.

prtest:full
Redpanda embeds Wasmtime to power our inline data transforms, allowing developers to transform data directly within the broker.
* winch: Multi-Value Part 2: Blocks

This commit adds support for the Multi-Value proposal for blocks.

In general, this change, introduces multiple building blocks to enable
supporting arbitrary params and results in blocks:

* `BlockType`: Introduce a block type, to categorize the type of each
  block, this makes it easier to categorize blocks per type and also
  makes it possible to defer the calculation of the `ABIResults` until
  they are actually needed rather than calculating everyghing upfront
  even though they might not be needed (when in an unreachable state).
* Push/pop operations are now frame aware. Given that each
  `ControlStackFrame` contains all the information needed regarding
  params and results, this change moves the the implementation of the
  push and pop operations to the `ControlStackFrame` struct.
* `StackState`: this struct holds the entry and exit invariants of each
  block; these invariants are pre-computed when entering the block and
  used throughout the code generation, to handle params, results and
  assert the respective invariants.

In terms of the mechanics of the implementation: when entering each
block, if there are results on the stack, the expected stack pointer
offsets will be calculated via the `StackState`, and the `target_offset`
will be used to create the block's `RetArea`. Note that when entering
the block and calculating the `StackState` no space is actually reserved
for the results, any space increase in the stack is deffered until the
results are popped from the value stack via
`ControlStackFrame::pop_abi_results`.

The trickiest bit of the implementation is handling constant values that
need to be placed on the right location on the machine stack. Given that
constants are generally not spilled, this means that in order to keep
the machine and value stack in sync (spilled-values-wise), values must
be shuffled to ensure that constants are placed in the expected location results wise.
See the comment in `ControlStackFrame::adjust_stack_results` for more
details.

* Review fixes
@dhil dhil enabled auto-merge January 9, 2024 09:02
@dhil dhil merged commit 3d6fef1 into wasmfx:main Jan 9, 2024
4 checks passed
@dhil dhil deleted the wasmfx-merge branch January 9, 2024 09:31
dhil pushed a commit that referenced this pull request Aug 2, 2024
In bytecodealliance#8873, we stopped tracking the wasi-nn's upstream WIT files
temporarily because it was not clear to me at the time how to implement
errors as CM resources. This PR fixes that, resuming tracking in the
`vendor-wit.sh` and implementing what is needed in the wasi-nn crate.

This leaves several threads unresolved, though:
- it looks like the `vendor-wit.sh` has a new mechanism for retrieving
  files into `wit/deps`--at some point wasi-nn should migrate to use
  that (?)
- it's not clear to me that "errors as resources" is even the best
  approach here; I've opened [#75] to consider the possibility of using
  "errors as records" instead.
- this PR identifies that the constructor for errors is in fact
  unnecessary, prompting an upstream change ([#76]) that should
  eventually be implemented here.

[#75]: WebAssembly/wasi-nn#75
[#76]: WebAssembly/wasi-nn#76

prtest:full
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.

4 participants