Repository navigation
feat(photonics): wire codec, Quandela job helpers, batched reservoir - #73
Merged
Merged
Conversation
sarseniy
temporarily deployed
to
docs-preview
November 24, 2026 13:20 — with
GitHub Actions
Inactive
|
Docs preview: https://pr-73.eigenkit-docs.pages.dev |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||
Building a Quandela Cloud job goes through Perceval methods that share state between instances, so concurrent builds could swap input states or corrupt an experiment. The Perceval section now runs under a lock. A platform without the sample_count command is refused, because its results would need a conversion cloud_job_counts does not make. The codec writes NumPy scalars inside angle expressions as Python numbers.
sarseniy
had a problem deploying
to
docs-preview
November 24, 2026 13:37 — with
GitHub Actions
Failure
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three additions to the photonic ring. They let a service run eigenkit's photonic circuits on Quandela Cloud for its users, and let a photonic reservoir run as one job instead of one job per time step.
eigenkit.photonics.wire:photonic_spec_to_jsonandphotonic_spec_from_json, a JSON codec forPhotonicCircuitSpec. It is the photonic counterpart ofcore.wire, holds only data, and encodes angles with the parameter encoding the qubit codec already uses.cloud_job_bodyandcloud_job_countsinphotonics/backends/perceval_remote.py. The first builds the request that creates a Quandela Cloud job, with one run for each row of inputs. The second reads the counts of a finished job, one dictionary per row. Neither opens a connection nor needs a token: the body is built by Perceval's ownRemoteProcessorandSampler, given a handler that answers the platform details and keeps the body instead of sending it.run_photonic_reservoircallscompiled.run_batch(weights, rows)once when the executor offers it, and loops overrunotherwise.run_batchis not part of theCompiledprotocol, so the existing executors still satisfy it.Why a batch is built this way
A Quandela Cloud job can carry several iterations of one circuit, each with its own parameter values. The circuit is built with one named Perceval parameter per angle, and each row carries the number of every angle, resolved with
core.ir.resolve. So a batch works for any angle expression, and the per-row values are the ones the single-run path computes.A 480-row batch of a reservoir of the size
examples/photonics_reservoir.pyuses (4 modes, 2 photons, depth 2), with 2000 shots per row, ran as one job onsim:slosin 21 seconds. Rows 0, 239 and 479 were within a total variation distance of 0.02 of the exact local SLOS distribution.Concurrency
cloud_job_bodycan be called from several threads. Perceval dispatches some methods,with_inputand the serializer among them, through state that all instances share, so unguarded concurrent builds could swap input states or corrupt an experiment. The calls into Perceval run under one lock; a build takes a few milliseconds.test_concurrent_builds_do_not_mixreproduces the problem without the lock.Compatibility
core.wireandcore/blocks.pyare untouched.import eigenkit.photonicsstill loads neither Perceval nor PyTorch.eigenkit.photonics.wirejoins the import-linter contract "Photonics compute layer is framework-free".Tests
tests/photonics/test_wire.py: golden encoding and decoding, a round trip of a reservoir, numpy scalars, malformed input, no Perceval import.tests/photonics/test_cloud_job.py: every row binds to the same unitary as the single-run builderbuild_perceval_circuit, concurrent builds do not mix, a platform withoutsample_countis refused, one iteration per row with the resolved angles, the shot budget of every row, the photon filter, wrong shapes, no connection opened, and the counts of recorded results (a single run, a batch, a row with no surviving shot, a job without counts). The results intests/photonics/fixtures/were recorded onsim:slos; the platform description there is a minimal one written by hand.tests/photonics/test_reservoir.py:run_batchis called once with all the rows and gives the same features as the loop; a batch of the wrong length is refused.Docs
The photonics guide gains a section on running through the EigenOrbit Router, and its note on batching is corrected.