SUServo: Variable with the same name doesn't get overwritten in some cases? #285
Labels
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#285
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I had a hunch about the SUServo that maybe the compiler calculated constants differently (different order of operations, maybe) and did a quick check. Well, that wasn't the case, but I found something else.
Consider this function:
https://github.com/m-labs/artiq/blob/nac3/artiq/coredevice/suservo.py#L130
Within the context of
set_config
- simple address + value, nothing complicated.Throw in some print_rpc to see what's happening with the variable:
Output:
Change the names of the variables a little bit so the compiler doesn't get too lost:
Output:
and suservo driver finally gets status back but still no output - status is not OK, maybe some other math is also not applied
Obviously, this caused config to be written in a wrong place, and prevented suservo from working. Looks like a problem with the compiler.
Weirdly enough, if I put it as a standalone test like this:
it prints correct values:
I am not sure if I missed anything.. I tried to reproduce the problem using the following setup (artiq: nac3 branch, nac3: current master branch,
device_db.py
as attached)and the output seems fine?
This is indeed almost like the standalone test above, is there any more context I need to put the code in?
@ychenfo you probably need more of the original code to reproduce the problem. It seems that unrelated code changes create some corruption in the compiler.
Thanks! Read the issue more carefully and now I am able to reproduce this. Seems that in IR after constant propagation the value is already wrong, looking into this now.
Turns out to be the problem with KernelInvariant handling, in
set_config
, passing3072
instead ofCONFIG_ADDR
gives the correct output, looking into how to solve it in codegen.@ychenfo would you be able to test this (and the rest of SU-Servo) on a remote system?
The fix of this bug of assigning variables is tested on the remote system.
For testing the rest of suservo, does it mean the tests related to suservo in
artiq_sinara_tester
? I think I must have missed something because the result I got by runningartiq_sinara_tester -o suservos
is the same before and after the fix? They are both the following:Hey, yes that behavior is exactly what I experienced - so the output is correct. Affected would be the actual configuration of the SUServo, and the behavior mentioned by the tester would not work correctly.
I could test it on actual hardware with checking the output later when I get a spare Sampler.
#270 (comment)