From deb8e23ffda092e1bf0e9b8a0f19aeae9379d52c Mon Sep 17 00:00:00 2001 From: Lexi Bromfield Date: Fri, 23 Sep 2022 14:08:09 -0400 Subject: [PATCH 1/2] Mark AVX- and SSE-using targets as incompatible with non-x86 platforms. --- lib/BUILD | 189 +++++++++++++++++++++++----------- tests/BUILD | 284 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 293 insertions(+), 180 deletions(-) diff --git a/lib/BUILD b/lib/BUILD index 9be39dea..e8a48857 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -12,13 +12,14 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "qsim_lib", hdrs = [ + # keep sorted "bits.h", "bitstring.h", "channel.h", "channels_cirq.h", + "circuit.h", "circuit_noisy.h", "circuit_qsim_parser.h", - "circuit.h", "expect.h", "formux.h", "fuser.h", @@ -29,8 +30,8 @@ cc_library( "gates_cirq.h", "gates_qsim.h", "hybrid.h", - "io_file.h", "io.h", + "io_file.h", "matrix.h", "mps_simulator.h", "mps_statespace.h", @@ -41,29 +42,34 @@ cc_library( "seqfor.h", "simmux.h", "simulator.h", - "simulator_avx.h", - "simulator_avx512.h", "simulator_basic.h", - "simulator_sse.h", - "statespace_avx.h", - "statespace_avx512.h", - "statespace_basic.h", - "statespace_sse.h", "statespace.h", + "statespace_basic.h", "umux.h", + "unitary_calculator_basic.h", "unitaryspace.h", - "unitaryspace_avx.h", - "unitaryspace_avx512.h", "unitaryspace_basic.h", - "unitaryspace_sse.h", - "unitary_calculator_avx.h", - "unitary_calculator_avx512.h", - "unitary_calculator_basic.h", - "unitary_calculator_sse.h", "util.h", "util_cpu.h", "vectorspace.h", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + # keep sorted + "simulator_avx.h", + "simulator_avx512.h", + "simulator_sse.h", + "statespace_avx.h", + "statespace_avx512.h", + "statespace_sse.h", + "unitary_calculator_avx.h", + "unitary_calculator_avx512.h", + "unitary_calculator_sse.h", + "unitaryspace_avx.h", + "unitaryspace_avx512.h", + "unitaryspace_sse.h", + ], + "//conditions:default": [], + }), ) # Full qsim library, including CUDA @@ -75,9 +81,9 @@ cc_library( "bitstring.h", "channel.h", "channels_cirq.h", + "circuit.h", "circuit_noisy.h", "circuit_qsim_parser.h", - "circuit.h", "expect.h", "formux.h", "fuser.h", @@ -88,8 +94,8 @@ cc_library( "gates_cirq.h", "gates_qsim.h", "hybrid.h", - "io_file.h", "io.h", + "io_file.h", "matrix.h", "mps_simulator.h", "mps_statespace.h", @@ -100,41 +106,47 @@ cc_library( "seqfor.h", "simmux.h", "simulator.h", - "simulator_avx.h", - "simulator_avx512.h", "simulator_basic.h", - "simulator_sse.h", "simulator_cuda.h", "simulator_cuda_kernels.h", - "statespace_avx.h", - "statespace_avx512.h", + "statespace.h", "statespace_basic.h", - "statespace_sse.h", "statespace_cuda.h", "statespace_cuda_kernels.h", - "statespace.h", "umux.h", + "unitary_calculator_basic.h", "unitaryspace.h", - "unitaryspace_avx.h", - "unitaryspace_avx512.h", "unitaryspace_basic.h", - "unitaryspace_sse.h", - "unitary_calculator_avx.h", - "unitary_calculator_avx512.h", - "unitary_calculator_basic.h", - "unitary_calculator_sse.h", "util.h", "util_cpu.h", "util_cuda.h", "vectorspace.h", "vectorspace_cuda.h", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + # keep sorted + "simulator_avx.h", + "simulator_avx512.h", + "simulator_sse.h", + "statespace_avx.h", + "statespace_avx512.h", + "statespace_sse.h", + "unitary_calculator_avx.h", + "unitary_calculator_avx512.h", + "unitary_calculator_sse.h", + "unitaryspace_avx.h", + "unitaryspace_avx512.h", + "unitaryspace_sse.h", + ], + "//conditions:default": [], + }), ) # Library to run qsim with qsim circuit parser and parallel `for` cc_library( name = "run_qsim_lib", hdrs = [ + # keep sorted "bits.h", "circuit.h", "circuit_qsim_parser.h", @@ -154,33 +166,39 @@ cc_library( "seqfor.h", "simmux.h", "simulator.h", - "simulator_avx.h", - "simulator_avx512.h", "simulator_basic.h", - "simulator_sse.h", "statespace.h", - "statespace_avx.h", - "statespace_avx512.h", "statespace_basic.h", - "statespace_sse.h", "umux.h", + "unitary_calculator_basic.h", "unitaryspace.h", - "unitaryspace_avx.h", "unitaryspace_basic.h", - "unitaryspace_sse.h", - "unitary_calculator_avx.h", - "unitary_calculator_basic.h", - "unitary_calculator_sse.h", "util.h", "util_cpu.h", "vectorspace.h", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + # keep sorted + "simulator_avx.h", + "simulator_avx512.h", + "simulator_sse.h", + "statespace_avx.h", + "statespace_avx512.h", + "statespace_sse.h", + "unitary_calculator_avx.h", + "unitary_calculator_sse.h", + "unitaryspace_avx.h", + "unitaryspace_sse.h", + ], + "//conditions:default": [], + }), ) # Library to run qsimh with qsim circuit parser and parallel `for` cc_library( name = "run_qsimh_lib", hdrs = [ + # keep sorted "bits.h", "circuit.h", "circuit_qsim_parser.h", @@ -201,19 +219,24 @@ cc_library( "seqfor.h", "simmux.h", "simulator.h", - "simulator_avx.h", - "simulator_avx512.h", "simulator_basic.h", - "simulator_sse.h", "statespace.h", - "statespace_avx.h", - "statespace_avx512.h", "statespace_basic.h", - "statespace_sse.h", "util.h", "util_cpu.h", "vectorspace.h", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + # keep sorted + "simulator_avx.h", + "simulator_avx512.h", + "simulator_sse.h", + "statespace_avx.h", + "statespace_avx512.h", + "statespace_sse.h", + ], + "//conditions:default": [], + }), ) ##### Basic libraries ##### @@ -425,6 +448,9 @@ cc_library( cc_library( name = "statespace_avx", hdrs = ["statespace_avx.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace", ":util", @@ -435,6 +461,9 @@ cc_library( cc_library( name = "statespace_avx512", hdrs = ["statespace_avx512.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace", ":util", @@ -455,6 +484,9 @@ cc_library( cc_library( name = "statespace_sse", hdrs = ["statespace_sse.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace", ":util", @@ -487,6 +519,9 @@ cc_library( cc_library( name = "simulator_avx", hdrs = ["simulator_avx.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":statespace_avx", @@ -496,6 +531,9 @@ cc_library( cc_library( name = "simulator_avx512", hdrs = ["simulator_avx512.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":statespace_avx512", @@ -514,6 +552,9 @@ cc_library( cc_library( name = "simulator_sse", hdrs = ["simulator_sse.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":statespace_sse", @@ -539,11 +580,15 @@ cc_library( name = "simulator", hdrs = ["simmux.h"], deps = [ - ":simulator_avx", - ":simulator_avx512", ":simulator_basic", - ":simulator_sse", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + ":simulator_avx", + ":simulator_avx512", + ":simulator_sse", + ], + "//conditions:default": [], + }), ) # Hybrid simulator @@ -607,6 +652,9 @@ cc_library( cc_library( name = "unitaryspace_avx", hdrs = ["unitaryspace_avx.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace", ":vectorspace", @@ -616,6 +664,9 @@ cc_library( cc_library( name = "unitaryspace_avx512", hdrs = ["unitaryspace_avx512.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace", ":vectorspace", @@ -634,6 +685,9 @@ cc_library( cc_library( name = "unitaryspace_sse", hdrs = ["unitaryspace_sse.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace", ":vectorspace", @@ -645,6 +699,9 @@ cc_library( cc_library( name = "unitary_calculator_avx", hdrs = ["unitary_calculator_avx.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":unitaryspace_avx", @@ -654,6 +711,9 @@ cc_library( cc_library( name = "unitary_calculator_avx512", hdrs = ["unitary_calculator_avx512.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":unitaryspace_avx512", @@ -672,6 +732,9 @@ cc_library( cc_library( name = "unitary_calculator_sse", hdrs = ["unitary_calculator_sse.h"], + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_base", ":unitaryspace_sse", @@ -684,11 +747,15 @@ cc_library( name = "umux", hdrs = ["umux.h"], deps = [ - ":unitary_calculator_avx", - ":unitary_calculator_avx512", ":unitary_calculator_basic", - ":unitary_calculator_sse", - ], + ] + select({ + "@platforms//cpu:x86_64": [ + ":unitary_calculator_avx", + ":unitary_calculator_avx512", + ":unitary_calculator_sse", + ], + "//conditions:default": [], + }), ) ### All MPS headers ### diff --git a/tests/BUILD b/tests/BUILD index a6c05c96..27961b1f 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -1,7 +1,12 @@ # Options for testing different simulator types. -avx_copts = ['-mavx2', '-mfma'] -avx512_copts = ['-march=native'] -sse_copts = ['-msse4'] +avx_copts = [ + "-mavx2", + "-mfma", +] + +avx512_copts = ["-march=native"] + +sse_copts = ["-msse4"] windows_copts = [ "/arch:AVX", @@ -26,33 +31,36 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:bitstring", + "@com_google_googletest//:gtest_main", ], ) cc_test( name = "channel_test", srcs = ["channel_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": [], + }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:channel", "//lib:formux", "//lib:gates_cirq", "//lib:matrix", "//lib:simulator", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": [], - }), ) cc_test( name = "channels_cirq_test", srcs = ["channels_cirq_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": [], + }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:channels_cirq", "//lib:circuit", "//lib:formux", @@ -61,11 +69,8 @@ cc_test( "//lib:io", "//lib:qtrajectory", "//lib:simulator", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": [], - }), ) cc_test( @@ -76,17 +81,20 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:circuit_qsim_parser", "//lib:gates_qsim", + "@com_google_googletest//:gtest_main", ], ) cc_test( name = "expect_test", srcs = ["expect_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": [], + }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:expect", "//lib:formux", "//lib:fuser_mqubit", @@ -94,11 +102,8 @@ cc_test( "//lib:gates_qsim", "//lib:io", "//lib:simulator", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": [], - }), ) cc_test( @@ -109,10 +114,10 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:circuit_qsim_parser", "//lib:fuser_basic", "//lib:gates_qsim", + "@com_google_googletest//:gtest_main", ], ) @@ -124,25 +129,25 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:formux", "//lib:fuser_mqubit", "//lib:gate", "//lib:gate_appl", "//lib:matrix", "//lib:simulator", + "@com_google_googletest//:gtest_main", ], ) cc_library( name = "gates_cirq_testfixture", + testonly = 1, hdrs = ["gates_cirq_testfixture.h"], deps = [ - "@com_google_googletest//:gtest_main", "//lib:circuit", "//lib:gates_cirq", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( @@ -153,43 +158,46 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:gates_qsim", + "@com_google_googletest//:gtest_main", ], ) cc_library( name = "hybrid_testfixture", + testonly = 1, hdrs = ["hybrid_testfixture.h"], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:circuit_qsim_parser", "//lib:formux", "//lib:fuser_basic", "//lib:gates_qsim", "//lib:hybrid", "//lib:io", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( name = "hybrid_avx_test", srcs = ["hybrid_avx_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": avx_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":hybrid_testfixture", - "@com_google_googletest//:gtest_main", "//lib:seqfor", "//lib:simulator_avx", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": avx_copts, - }), ) cc_test( @@ -200,20 +208,20 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:matrix", + "@com_google_googletest//:gtest_main", ], ) cc_library( name = "qtrajectory_testfixture", + testonly = 1, hdrs = ["qtrajectory_testfixture.h"], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:channel", "//lib:channels_cirq", "//lib:circuit_noisy", @@ -223,224 +231,246 @@ cc_library( "//lib:gates_cirq", "//lib:io", "//lib:qtrajectory", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( name = "qtrajectory_avx_test", srcs = ["qtrajectory_avx_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": avx_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":qtrajectory_testfixture", - "@com_google_googletest//:gtest_main", "//lib:seqfor", "//lib:simulator_avx", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": avx_copts, - }), ) cc_test( name = "run_qsim_test", srcs = ["run_qsim_test.cc"], - deps = [ - ":gates_cirq_testfixture", - "@com_google_googletest//:gtest_main", - "//lib:run_qsim_lib", - ], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), + deps = [ + ":gates_cirq_testfixture", + "//lib:run_qsim_lib", + "@com_google_googletest//:gtest_main", + ], ) cc_test( name = "run_qsimh_test", srcs = ["run_qsimh_test.cc"], - deps = [ - ":gates_cirq_testfixture", - "@com_google_googletest//:gtest_main", - "//lib:run_qsimh_lib", - ], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), + deps = [ + ":gates_cirq_testfixture", + "//lib:run_qsimh_lib", + "@com_google_googletest//:gtest_main", + ], ) cc_library( name = "simulator_testfixture", + testonly = 1, hdrs = ["simulator_testfixture.h"], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:expect", "//lib:fuser_mqubit", "//lib:gate_appl", "//lib:gates_qsim", "//lib:io", "//lib:util_cpu", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( name = "simulator_avx_test", srcs = ["simulator_avx_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": avx_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_avx", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": avx_copts, - }), ) cc_test( name = "simulator_avx512_test", srcs = ["simulator_avx512_test.cc"], + copts = select({ + ":windows": windows_avx512_copts, + "//conditions:default": avx512_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_avx512", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_avx512_copts, - "//conditions:default": avx512_copts, - }), ) cc_test( name = "simulator_basic_test", srcs = ["simulator_basic_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": [], + }), deps = [ ":simulator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_basic", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": [], - }), ) cc_test( name = "simulator_sse_test", srcs = ["simulator_sse_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": sse_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":simulator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_sse", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": sse_copts, - }), ) cc_library( name = "statespace_testfixture", + testonly = 1, hdrs = ["statespace_testfixture.h"], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:circuit_qsim_parser", "//lib:fuser_basic", "//lib:gates_qsim", "//lib:io", "//lib:run_qsim", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( name = "statespace_avx_test", srcs = ["statespace_avx_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": avx_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_avx", "//lib:statespace_avx", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": avx_copts, - }), ) cc_test( name = "statespace_avx512_test", srcs = ["statespace_avx512_test.cc"], + copts = select({ + ":windows": windows_avx512_copts, + "//conditions:default": avx512_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_avx512", "//lib:statespace_avx512", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_avx512_copts, - "//conditions:default": avx512_copts, - }), ) cc_test( name = "statespace_basic_test", srcs = ["statespace_basic_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": [], + }), deps = [ ":statespace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_basic", "//lib:statespace_basic", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": [], - }), ) cc_test( name = "statespace_sse_test", srcs = ["statespace_sse_test.cc"], + copts = select({ + ":windows": windows_copts, + "//conditions:default": sse_copts, + }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":statespace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:parfor", "//lib:seqfor", "//lib:simulator_sse", "//lib:statespace_sse", + "@com_google_googletest//:gtest_main", ], - copts = select({ - ":windows": windows_copts, - "//conditions:default": sse_copts, - }), ) cc_library( name = "unitaryspace_testfixture", + testonly = 1, hdrs = ["unitaryspace_testfixture.h"], copts = select({ ":windows": windows_copts, @@ -449,7 +479,6 @@ cc_library( deps = [ "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( @@ -459,11 +488,14 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_avx" + "//lib:unitaryspace_avx", + "@com_google_googletest//:gtest_main", ], ) @@ -474,11 +506,14 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_avx512" + "//lib:unitaryspace_avx512", + "@com_google_googletest//:gtest_main", ], ) @@ -491,9 +526,9 @@ cc_test( }), deps = [ ":unitaryspace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_basic" + "//lib:unitaryspace_basic", + "@com_google_googletest//:gtest_main", ], ) @@ -504,28 +539,31 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitaryspace_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_sse" + "//lib:unitaryspace_sse", + "@com_google_googletest//:gtest_main", ], ) cc_library( name = "unitary_calculator_testfixture", + testonly = 1, hdrs = ["unitary_calculator_testfixture.h"], copts = select({ ":windows": windows_copts, "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:fuser", "//lib:gate_appl", "//lib:gates_cirq", + "@com_google_googletest//:gtest_main", ], - testonly = 1, ) cc_test( @@ -535,12 +573,15 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitary_calculator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_avx", "//lib:unitary_calculator_avx", + "//lib:unitaryspace_avx", + "@com_google_googletest//:gtest_main", ], ) @@ -551,12 +592,15 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitary_calculator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_avx512", "//lib:unitary_calculator_avx512", + "//lib:unitaryspace_avx512", + "@com_google_googletest//:gtest_main", ], ) @@ -569,10 +613,10 @@ cc_test( }), deps = [ ":unitary_calculator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_basic", "//lib:unitary_calculator_basic", + "//lib:unitaryspace_basic", + "@com_google_googletest//:gtest_main", ], ) @@ -583,12 +627,15 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), + target_compatible_with = [ + "@platforms//cpu:x86_64", + ], deps = [ ":unitary_calculator_testfixture", - "@com_google_googletest//:gtest_main", "//lib:formux", - "//lib:unitaryspace_sse", "//lib:unitary_calculator_sse", + "//lib:unitaryspace_sse", + "@com_google_googletest//:gtest_main", ], ) @@ -600,9 +647,9 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", "//lib:formux", "//lib:vectorspace", + "@com_google_googletest//:gtest_main", ], ) @@ -614,13 +661,12 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", - "//lib:mps_statespace", "//lib:formux", + "//lib:mps_statespace", + "@com_google_googletest//:gtest_main", ], ) - cc_test( name = "mps_simulator_test", srcs = ["mps_simulator_test.cc"], @@ -629,11 +675,11 @@ cc_test( "//conditions:default": [], }), deps = [ - "@com_google_googletest//:gtest_main", + "//lib:formux", "//lib:gate_appl", "//lib:gates_cirq", "//lib:gates_qsim", "//lib:mps_simulator", - "//lib:formux", + "@com_google_googletest//:gtest_main", ], ) From 74bfdd80f084edebdb0464d767f05832d8bb10ae Mon Sep 17 00:00:00 2001 From: Lexi Bromfield Date: Fri, 23 Sep 2022 16:00:44 -0400 Subject: [PATCH 2/2] target_compatible_with is not supported by this version of bazel --- lib/BUILD | 36 ------------------------------------ tests/BUILD | 42 ------------------------------------------ 2 files changed, 78 deletions(-) diff --git a/lib/BUILD b/lib/BUILD index e8a48857..7547cda6 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -448,9 +448,6 @@ cc_library( cc_library( name = "statespace_avx", hdrs = ["statespace_avx.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace", ":util", @@ -461,9 +458,6 @@ cc_library( cc_library( name = "statespace_avx512", hdrs = ["statespace_avx512.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace", ":util", @@ -484,9 +478,6 @@ cc_library( cc_library( name = "statespace_sse", hdrs = ["statespace_sse.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace", ":util", @@ -519,9 +510,6 @@ cc_library( cc_library( name = "simulator_avx", hdrs = ["simulator_avx.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":statespace_avx", @@ -531,9 +519,6 @@ cc_library( cc_library( name = "simulator_avx512", hdrs = ["simulator_avx512.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":statespace_avx512", @@ -552,9 +537,6 @@ cc_library( cc_library( name = "simulator_sse", hdrs = ["simulator_sse.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":statespace_sse", @@ -652,9 +634,6 @@ cc_library( cc_library( name = "unitaryspace_avx", hdrs = ["unitaryspace_avx.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace", ":vectorspace", @@ -664,9 +643,6 @@ cc_library( cc_library( name = "unitaryspace_avx512", hdrs = ["unitaryspace_avx512.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace", ":vectorspace", @@ -685,9 +661,6 @@ cc_library( cc_library( name = "unitaryspace_sse", hdrs = ["unitaryspace_sse.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace", ":vectorspace", @@ -699,9 +672,6 @@ cc_library( cc_library( name = "unitary_calculator_avx", hdrs = ["unitary_calculator_avx.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":unitaryspace_avx", @@ -711,9 +681,6 @@ cc_library( cc_library( name = "unitary_calculator_avx512", hdrs = ["unitary_calculator_avx512.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":unitaryspace_avx512", @@ -732,9 +699,6 @@ cc_library( cc_library( name = "unitary_calculator_sse", hdrs = ["unitary_calculator_sse.h"], - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_base", ":unitaryspace_sse", diff --git a/tests/BUILD b/tests/BUILD index 27961b1f..05bcde64 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -189,9 +189,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":hybrid_testfixture", "//lib:seqfor", @@ -242,9 +239,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":qtrajectory_testfixture", "//lib:seqfor", @@ -307,9 +301,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_testfixture", "//lib:parfor", @@ -326,9 +317,6 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_testfixture", "//lib:parfor", @@ -361,9 +349,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":simulator_testfixture", "//lib:parfor", @@ -398,9 +383,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace_testfixture", "//lib:parfor", @@ -418,9 +400,6 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace_testfixture", "//lib:parfor", @@ -455,9 +434,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":statespace_testfixture", "//lib:parfor", @@ -488,9 +464,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace_testfixture", "//lib:formux", @@ -506,9 +479,6 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace_testfixture", "//lib:formux", @@ -539,9 +509,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitaryspace_testfixture", "//lib:formux", @@ -573,9 +540,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": avx_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitary_calculator_testfixture", "//lib:formux", @@ -592,9 +556,6 @@ cc_test( ":windows": windows_avx512_copts, "//conditions:default": avx512_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitary_calculator_testfixture", "//lib:formux", @@ -627,9 +588,6 @@ cc_test( ":windows": windows_copts, "//conditions:default": sse_copts, }), - target_compatible_with = [ - "@platforms//cpu:x86_64", - ], deps = [ ":unitary_calculator_testfixture", "//lib:formux",