Skip to content

Commit cd12946

Browse files
committed
Add support Conv and pooling
1 parent 3b34b85 commit cd12946

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

operatorspy/tests/avg_pool.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ def test(
152152
elapsed = (time.time() - start_time) / NUM_ITERATIONS
153153
print(f" lib time: {elapsed :6f}")
154154

155-
156-
print(x)
157-
print(y)
158-
print(ans)
159155
assert torch.allclose(y, ans, atol=0, rtol=1e-3)
160156
check_error(lib.infiniopDestroyAvgPoolDescriptor(descriptor))
161157

@@ -205,7 +201,7 @@ def test_musa(lib, test_cases):
205201
# ((1, 1, 10), (3,), (1,), (1,)),
206202
((1, 1, 2, 2), (2, 2), (1, 1), (1, 1)),
207203
((32, 4, 224, 224), (3, 3), (1, 1), (2, 2)),
208-
((1, 1, 16, 16, 16), (5, 5, 5), (2, 2, 2), (2, 2, 2)),
204+
# ((1, 1, 16, 16, 16), (5, 5, 5), (2, 2, 2), (2, 2, 2)),
209205
]
210206
args = get_args()
211207
lib = open_lib()

operatorspy/tests/global_avg_pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ def test_musa(lib, test_cases):
158158
test_cases = [
159159
# x_shape
160160
((1, 1, 2, 2)),
161-
# ((1, 3, 3)),
161+
((1, 3, 3, 6)),
162+
((8, 4, 6, 12)),
162163
# ((1, 3, 1, 1, 3)),
163164
# ((1, 3, 1, 1, 257)),
164165
# ((1, 2, 1, 1, 514)),

operatorspy/tests/max_pool.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ def test(
148148
)
149149
elapsed = (time.time() - start_time) / NUM_ITERATIONS
150150
print(f" lib time: {elapsed :6f}")
151-
print(x)
152-
print(y)
153-
print(ans)
151+
# print(x)
152+
# print(y)
153+
# print(ans)
154154
assert torch.allclose(y, ans, atol=0, rtol=1e-3)
155155
check_error(lib.infiniopDestroyMaxPoolDescriptor(descriptor))
156156

@@ -198,7 +198,9 @@ def test_musa(lib, test_cases):
198198
test_cases = [
199199
# x_shape, kernel_shape, padding, strides
200200
# ((1, 1, 10), (3,), (1,), (1,)),
201-
# ((32, 3, 224, 224), (3, 3), (1, 1), (2, 2)),
201+
((32, 3, 224, 224), (3, 3), (1, 1), (2, 2)),
202+
((1, 3, 6, 6), (3, 3), (1, 1), (2, 2)),
203+
((8, 3, 12, 12), (3, 3), (1, 1), (2, 2)),
202204
((1, 1, 4, 4), (2, 2), (0, 0), (1, 1)),
203205
# ((1, 1, 16, 16, 16), (5, 5, 5), (2, 2, 2), (2, 2, 2)),
204206
]

src/ops/add/musa/add_musa.mu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void _add_mt_gpu(AddMusaDescriptor_t desc, Tdata *c, Tdata const *a, Tdata const
8484
add<Tdata, BTdata><<<gridDims, blockDims, 0, musa_stream>>>(
8585
c, a, b, desc->a_strides, desc->b_strides, desc->c_strides, offset + data_size, desc->ndim, offset + i, desc->broadcasted, pack_size);
8686
}
87+
printf("[SUCCESS to execute add_mt_gpu]\n");
8788
}
8889

8990
template<typename Tdata, typename TIdata>

src/ops/pooling/musa/pooling_musa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ inline musa::dnn::Pooling::Mode getPoolingMode(int pooling_type) {
4646
return musa::dnn::Pooling::Mode::MAXPOOL;
4747
case 1:
4848
return musa::dnn::Pooling::Mode::AVGPOOL_COUNT_PAD;
49+
// return musa::dnn::Pooling::Mode::AVGPOOL_COUNT_WITHOUT_PAD;
4950
default:
5051
return musa::dnn::Pooling::Mode::MAXPOOL;
5152
}

0 commit comments

Comments
 (0)