Implement passing kwarg to RPC #533 #579
No reviewers
Labels
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#579
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ramtej/nac3:feature/rpc-keywords"
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?
@ -0,0 +19,4 @@
def run(self):
#1) All positional => a=1, b=2, c=3 -> total=6
s1 = sum_3(1, 2, 3)
if s1 != 6:
use
assert
instead?We don't support exceptions in
runkernel
(yet?). One advantage ofnac3artiq/demo
is it can run on x86 without hardware.Though of course it's also not clear how to support RPC in runkernel.
Please address the comments, as well as run
cargo fmt --all
andcargo clippy --tests
and fix these warnings as well.@ -81,3 +81,2 @@
///
/// The current parallel context refers to the nearest `with parallel` or `with legacy_parallel`
/// statement, which is used to determine when and how the timeline should be updated.
/// The current parallel context refers to the nearest `with` statement, which is used to determine when and how the timeline should be updated.
Please reflow this line to keep within 100 characters perline.
@ -373,8 +372,14 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
fn gen_rpc_tag(
ctx: &mut CodeGenContext<'_, '_>,
ty: Type,
is_kwarg: bool, // Add this parameter
Is the comment necessary on the parameter?
@ -404,3 +409,3 @@
buffer.push(ty.len() as u8);
for ty in ty {
gen_rpc_tag(ctx, *ty, buffer)?;
gen_rpc_tag(ctx, *ty, false, buffer)?; // Pass false for is_kwarg
I think these comments are unnecessary, same for the changes below.
@ -815,1 +821,4 @@
gen_rpc_tag(ctx, fun.0.ret, false, &mut tag)?;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
Please move these
use
statements to the top of the file.@ -848,0 +864,4 @@
param_map[0] = Some(obj_val);
pos_index = 1;
}
for (maybe_key, val_enum) in args.drain(..) {
I don't think
drain
is necessary here. You can just iterate onargs
and it would consume the entireVec
- Plus themut
change to the parameter is also made unnecessary.@ -1234,6 +1234,45 @@ impl<'a> Inferencer<'a> {
}));
}
if ["np_shape".into(), "np_strides".into()].contains(id) && args.len() == 1 {
Please move these changes into a separate commit, they don't belong in the same commit as the RPC changes.
Checkout
From your project repository, check out a new branch and test the changes.