-
Notifications
You must be signed in to change notification settings - Fork 0
Adding noise statements to squin #211
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
base: main
Are you sure you want to change the base?
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
This is the simplest port of the noise statements that @kaihsin originally produced. I just have some observations/ideas that I'd appreciate getting feedback on (if it's worth it, I can make an RFC)
|
Oh my goodness Copilot please go away I beg you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM can we have some basic tests on the constructors? Or maybe you could help @david-pl add the corresponding runtime in a new PR (which should test this too). I think would be nice to have it before next week's hackthon.
@Roger-luo I'm happy to add the runtime. I'd just like to have #207 merged first. Are there any plans for adding a rewrite pass that injects the noise as well? |
@Roger-luo + @david-pl I think we could simplify the runtime if we added a target which would be able to handle a wider variety of channels and would be easy to implement with @statement(dialect=dialect)
class StochasticUnitaryChannel:
operators: ir.SSAValue = argument(ilist.IListType[OpType, NumOperators]
probabilities: ir.SSAValue = argument(ilist.IListType[float, NumOperators] you could basically just rewrite all these other specialized noise channels to this statement and then the runtime would be just randomly select which operator to apply. |
Some initial friction points/anticipated changes I can immediately see in translating this to stim
PauliChannel
definition from @kaihsin can take a variable number of float arguments, but in the stim dialect there are explicit fields for each probability of a 1Q/2Q pauli operator being applied. My feeling is that this should be reflected on the squin side as just something like1QPauliChannel
and2QPauliChannel
with explicit fields. I don't think we'd lose any generality here along with the added benefit that it would be much harder for a user to misinput information (the default definition assumes you plug in either 3 or 15 values via varargs but it seems to easy to make a mistake here)If we DO want varargs I'm not quite sure how to nicely feed this to the kirin@wraps
decoratorbasis
and instead use aCliffordString
(although I'd have to restrict CliffordString even further, to just the Pauli Operators. Would it be worth having something like aPauliString
? Or is that silly?)cc: @weinbe58 @Roger-luo @kaihsin