Skip to content

Commit

Permalink
Allow "InteropFriendly" as a synonym for "EntryPoint"; re-enable some…
Browse files Browse the repository at this point in the history
… tests.
  • Loading branch information
cqc-alec committed Mar 10, 2023
1 parent 8b9cc32 commit 4a55c16
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
5 changes: 4 additions & 1 deletion src/pytket_qirpass/apply_qirpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ def is_header_line(line: str) -> bool:

def is_entry_point(function: ValueRef) -> bool:
assert function.is_function
return any(b'"EntryPoint"' in attrs for attrs in function.attributes)
return any(
b'"EntryPoint"' in attrs or b'"InteropFriendly"' in attrs

This comment has been minimized.

Copy link
@peter-campora

peter-campora Mar 10, 2023

I'm not sure I'd allow InterOpFriendly as a valid attribute. Although I know I sent some examples with InteropFriendly, any tests you want me to fix that use InteropFriendly can be fixed. EntryPoint is the expected attribute, and if some QIR file got submitted to us with both an EntryPoint function and InteropFriendly function, then that would be an issue.

This comment has been minimized.

Copy link
@cqc-alec

cqc-alec Mar 10, 2023

Author Collaborator

I'm not sure I'd allow InterOpFriendly as a valid attribute. Although I know I sent some examples with InteropFriendly, any tests you want me to fix that use InteropFriendly can be fixed. EntryPoint is the expected attribute, and if some QIR file got submitted to us with both an EntryPoint function and InteropFriendly function, then that would be an issue.

OK, I can easily change this, and just replace InteropFriendly with EntryPoint in the test files. I found this issue where it is (briefly) mentioned.

This comment has been minimized.

Copy link
@cqc-alec

cqc-alec Mar 10, 2023

Author Collaborator

Done.

for attrs in function.attributes
)


def apply_qirpass(
Expand Down
74 changes: 37 additions & 37 deletions test/test_qirpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def ll_to_bc(ll: str) -> bytes:
"3_PauliX_PauliX_",
"4_PauliX_PauliX_",
"add_only",
# "and_only", # uses InteropFriendly instead of EntryPoint
"and_only",
"ArithmeticOps.TargetedAlt_",
"bad_div",
"bool_tag",
Expand All @@ -118,22 +118,22 @@ def ll_to_bc(ll: str) -> bytes:
"classical_flow6",
"classical_flow",
"comparison_instrs",
# "conditional_test_2", # uses InteropFriendly instead of EntryPoint
# "conditional-test-3", # uses InteropFriendly instead of EntryPoint
# "conditional_test_3", # uses InteropFriendly instead of EntryPoint
# "conditional_test_4", # uses InteropFriendly instead of EntryPoint
# "conditional_test", # uses InteropFriendly instead of EntryPoint
"conditional_test_2",
"conditional-test-3",
"conditional_test_3",
"conditional_test_4",
"conditional_test",
"cond_ops",
"control_flow_complex.baseProfile",
"control_flow_long.baseProfile",
"control_flow_nested.baseProfile",
"control_flow_short.baseProfile",
"cx_only",
# "Distillation", # uses InteropFriendly instead of EntryPoint
# "Distillation_other", # uses InteropFriendly instead of EntryPoint
# "Distillation_small", # uses InteropFriendly instead of EntryPoint
# "eq_only", # uses InteropFriendly instead of EntryPoint
# "fallthrough_simple", # uses InteropFriendly instead of EntryPoint
"Distillation",
"Distillation_other",
"Distillation_small",
"eq_only",
"fallthrough_simple",
"gate_stress_5qb",
"gate_stress_5qb_",
"gate_stress_test_10k",
Expand All @@ -151,9 +151,9 @@ def ll_to_bc(ll: str) -> bytes:
"gate_stress_test_50k",
"gate_stress_test",
"gate_stress_test_",
# "ge_only", # uses InteropFriendly instead of EntryPoint
"ge_only",
"ghz_fail_",
# "gt_only", # uses InteropFriendly instead of EntryPoint
"gt_only",
"h_only",
"IntegerComparison.TargetedAlt_",
"IntegerComparison.Targeted_",
Expand All @@ -162,22 +162,22 @@ def ll_to_bc(ll: str) -> bytes:
"int_tag_alt_",
"iqpe",
"iqpe_",
# "le_only", # uses InteropFriendly instead of EntryPoint
"le_only",
# "LogicalRb-BaseProfile.opt", # >1 defined function
"loopRecursion.baseProfile",
# "lshr_only", # uses InteropFriendly instead of EntryPoint
# "lt_only", # uses InteropFriendly instead of EntryPoint
"lshr_only",
"lt_only",
"MagicStateDistillation-BaseProfile.10X",
# "MagicStateDistillation-BaseProfile.3", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile-3X", # uses InteropFriendly instead of EntryPoint
"MagicStateDistillation-BaseProfile.3",
"MagicStateDistillation-BaseProfile-3X",
"MagicStateDistillation-BaseProfile.3X",
# "MagicStateDistillation.BaseProfile-4X", # >1 defined function
# "MagicStateDistillation-BaseProfile-5X", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile-6X", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile.6X", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile-7X", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile.8Y", # uses InteropFriendly instead of EntryPoint
# "MagicStateDistillation-BaseProfile.9X", # uses InteropFriendly instead of EntryPoint
"MagicStateDistillation-BaseProfile-5X",
"MagicStateDistillation-BaseProfile-6X",
"MagicStateDistillation-BaseProfile.6X",
"MagicStateDistillation-BaseProfile-7X",
"MagicStateDistillation-BaseProfile.8Y",
"MagicStateDistillation-BaseProfile.9X",
# "MagicStateDistillation-BaseProfile-NoInline.10X", # >1 defined function
# "MagicStateDistillation-BaseProfile.opt", # >1 defined function
"MagicStateDistillation-Grouping.10X",
Expand All @@ -188,20 +188,20 @@ def ll_to_bc(ll: str) -> bytes:
"measure_result",
"most_features",
# "most_features_", # "Instruction does not dominate all uses!"
# "mul_only", # uses InteropFriendly instead of EntryPoint
"mul_only",
"multi_arith",
"mutables_ops_branches.baseProfile",
"native_gates",
"negative_arith",
# "ne_only", # uses InteropFriendly instead of EntryPoint
"ne_only",
"nested_conditions",
# "no_entry", # uses InteropFriendly instead of EntryPoint
"no_entry",
"no-ops",
# "no_qubits", # uses InteropFriendly instead of EntryPoint
# "no_results", # uses InteropFriendly instead of EntryPoint
"no_qubits",
"no_results",
"null_tag",
"one_conditional",
# "or_only", # uses InteropFriendly instead of EntryPoint
"or_only",
"phi_test_1",
"phi_test_2",
"phi_test_3",
Expand Down Expand Up @@ -250,34 +250,34 @@ def ll_to_bc(ll: str) -> bytes:
"RUSLoopZZ-7_",
"RUSLoopZZ-8_",
"RUSLoopZZ-9_",
# "rx_only", # uses InteropFriendly instead of EntryPoint
# "rz_only", # uses InteropFriendly instead of EntryPoint
"rx_only",
"rz_only",
"select",
"select-nested-const-cond",
"select-nested",
"sequential_flow_1",
"sequential_flow_2",
"sge",
"sgt",
# "shl_only", # uses InteropFriendly instead of EntryPoint
# "SimpleGroverBaseProfile", # uses InteropFriendly instead of EntryPoint
"shl_only",
"SimpleGroverBaseProfile",
"SimpleGroverGrouped",
"SimpleGroverSample.BaseProfile",
# "SimpleGroverSample", # >1 defined function
# "SimpleGroverSample.O1", # >1 defined function
"sle",
"slt",
# "sub_only", # uses InteropFriendly instead of EntryPoint
"sub_only",
"tadj_only",
"tagged_duplicates",
"tagged_result_control_flow",
"tagged_result_control_flow_",
"teleportchain.BaseProfile",
"teleport-chain-grouping",
"t_only",
# "udiv_only", # uses InteropFriendly instead of EntryPoint
"udiv_only",
"x_only",
# "xor_only", # uses InteropFriendly instead of EntryPoint
"xor_only",
"XX_recursion_limit8",
"y_only",
"zext",
Expand Down

0 comments on commit 4a55c16

Please sign in to comment.