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

[enhancement] Allow cross-activation ordering constraints on side-effecting operations in procs #1401

Closed
ericastor opened this issue May 8, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ericastor
Copy link
Collaborator

What's hard to do? (limit 100 words)

Write a proc with specified ordering of I/O operations between activations; e.g., a proc that does thing A followed by thing B, and does not allow the next activation of thing A to run in parallel with the first activation of thing B.

Currently, there's no safe way to instruct XLS not to allow parallel execution of these operations as the next activation moves down the pipeline.

Current best alternative workaround (limit 100 words)

Add a state parameter that is an unremovable data dependency of "thing A", and make sure we can't determine its value until "thing B" is completed. This varies between difficult and impossible to do safely, as future optimizations may be able to see through the meaninglessness of this state parameter.

Your view of the "best case XLS enhancement" (limit 100 words)

Allow users to connect operations between activations with "tokens" - unremovable dependencies that contain no actual data. Note that order-sensitive side-effecting operations already return these in the IR and DSLX. If we could pass these on to the next activation in a way that XLS respects, this would suffice to let users specify cross-activation ordering restrictions as well.

@ericastor ericastor added the enhancement New feature or request label May 8, 2024
@ericastor ericastor added this to the Usability Sprint milestone May 8, 2024
copybara-service bot pushed a commit that referenced this issue May 9, 2024
Before this, XLS IR did not support any way to express the constraint that "in this proc, operation A in activation 1 must execute before operation B in activation 2". All procs took a single token and returned a single token, and in order to allow pipelining of side-effecting operations, XLS codegen did not consider the next activation's token to depend on the previous activation's token.

In this change, we remove the privileged status of the special token parameter; instead, tokens behave as state parameters that happen to take up 0 bits (but cannot be optimized away). During execution (and after codegen), operations depending on a given token state parameter must wait until after the previous activation resolves the corresponding `next_value` node.

To keep their semantics the same, this change switches both DSLX & XLS[cc] from emitting procs with a token state parameter to emitting procs that materialize a new independent token at the start of each activation.

Part 1 of addressing issue #1401

PiperOrigin-RevId: 632206439
@ericastor ericastor self-assigned this May 20, 2024
copybara-service bot pushed a commit that referenced this issue May 21, 2024
Part of the cleanup effort for #1401

PiperOrigin-RevId: 635794659
copybara-service bot pushed a commit that referenced this issue May 24, 2024
This is the first step in removing support for old-style proc-next.

Part of the cleanup effort for #1401

PiperOrigin-RevId: 636754206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant