MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / TEST_F

Function TEST_F

dnn/test/rocm/elemwise.cpp:61–74  ·  view source on GitHub ↗

the memory of this test case is too large, sometimes will fail on tx1

Source from the content-addressed store, hash-verified

59
60//! the memory of this test case is too large, sometimes will fail on tx1
61TEST_F(ROCM, ELEMWISE_BENCHMARK_DENSE) {
62 constexpr size_t A = 1024 * 1024 * 64, S0 = 64, S1 = 256, S2 = 64, S3 = 64;
63 static_assert(A == S0 * S1 * S2 * S3, "bad value");
64 SyncedTensor<> t0(handle_rocm(), {TensorShape{S0, S1, S2, S3}, dtype::Float32()}),
65 t1(handle_rocm(), {TensorShape{S0, S1, S2, S3}, dtype::Float32()});
66 UniformFloatRNG rng{-2.f, 2.f};
67 rng.gen(t0.tensornd_host());
68 run_tensor_add(
69 handle_rocm(), t0.tensornd_dev(), t0.tensornd_dev(), t1.tensornd_dev());
70 auto p0 = t0.ptr_host(), p1 = t1.ptr_host();
71 for (size_t i = 0; i < A; ++i) {
72 ASSERT_EQ(p0[i] + p0[i], p1[i]) << "at index " << i << "/" << A;
73 }
74}
75
76#if MEGDNN_WITH_BENCHMARK
77TEST_F(ROCM, ELEMWISE_BENCHMARK_BCAST_101) {

Callers

nothing calls this directly

Calls 2

run_tensor_addFunction · 0.70
genMethod · 0.45

Tested by

no test coverage detected