Skip to content

[XLS] Switch from external-adapter channel legalization to internal arbitration #2148

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

Merged
merged 1 commit into from
May 19, 2025

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented May 8, 2025

[XLS] Switch from external-adapter channel legalization to internal arbitration

To support relaxed channel strictness settings (allowing multiple operations per channel per activation), we previously translated all operations to take place on their own channels, then inserted an external arbitrating adapter to mux the channels back together. This resulted in duplicated control-flow logic, and was difficult to optimize well without full-powered proc inlining - which ran into its own problems.

Instead, we now implement relaxed strictnesses by implementing additional legalizations within the proc: adding token-typed state to avoid cross-activation conflicts, and adding scheduling constraints to avoid having multiple (non-mutually-exclusive) operations in the same activation trigger at the same time. To support this, we also modify codegen to allow multiple operations per channel, relying on earlier compilation steps to ensure that we never see more than one trigger in a given cycle.

This passes all existing tests, except for a few where it revealed issues that were previously hidden by our choices in implementing the external adapter. We modify those tests accordingly. As best as I can tell, this should be no worse for performance than the previous version.

NOTE: This will also allow us to support proven-mutually-exclusive channels with mutually-exclusive operations that can't be merged, which reduces merging to an optimization; we'll remove the forced-merge logic for this case in a followup CL.

Fixes #2180

@copybara-service copybara-service bot force-pushed the test_747607750 branch 3 times, most recently from 2b3ea9d to 2813bf1 Compare May 14, 2025 21:59
@copybara-service copybara-service bot force-pushed the test_747607750 branch 2 times, most recently from c8d2236 to 2da1275 Compare May 19, 2025 13:37
…rbitration

To support relaxed channel strictness settings (allowing multiple operations per channel per activation), we previously translated all operations to take place on their own channels, then inserted an external arbitrating adapter to mux the channels back together. This resulted in duplicated control-flow logic, and was difficult to optimize well without full-powered proc inlining - which ran into its own problems.

Instead, we now implement relaxed strictnesses by implementing additional legalizations within the proc: adding token-typed state to avoid cross-activation conflicts, and adding scheduling constraints to avoid having multiple (non-mutually-exclusive) operations in the same activation trigger at the same time. To support this, we also modify codegen to allow multiple operations per channel, relying on earlier compilation steps to ensure that we never see more than one trigger in a given cycle.

This passes all existing tests, except for a few where it revealed issues that were previously hidden by our choices in implementing the external adapter. We modify those tests accordingly. As best as I can tell, this should be no worse for performance than the previous version.

NOTE: This will also allow us to support proven-mutually-exclusive channels with mutually-exclusive operations that can't be merged, which reduces merging to an optimization; we'll remove the forced-merge logic for this case in a followup CL.

Fixes #2180

PiperOrigin-RevId: 760612461
@copybara-service copybara-service bot merged commit b0a0b50 into main May 19, 2025
@copybara-service copybara-service bot deleted the test_747607750 branch May 19, 2025 14:14
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.

Implement internal-arbitration multiplexing channels
1 participant