Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
7569675e
Commit
7569675e
authored
Apr 25, 2025
by
Graylatzhou
Browse files
issue/183 规范格式
parent
734c00a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
+21
-22
src/infiniop-test/include/ops.hpp
src/infiniop-test/include/ops.hpp
+1
-1
src/infiniop-test/src/ops/mul.cpp
src/infiniop-test/src/ops/mul.cpp
+9
-9
src/infiniop/ops/mul/cpu/mul_cpu.cc
src/infiniop/ops/mul/cpu/mul_cpu.cc
+11
-11
src/infiniop/ops/mul/operator.cc
src/infiniop/ops/mul/operator.cc
+0
-1
No files found.
src/infiniop-test/include/ops.hpp
View file @
7569675e
...
@@ -25,7 +25,7 @@ DECLARE_INFINIOP_TEST(mul)
...
@@ -25,7 +25,7 @@ DECLARE_INFINIOP_TEST(mul)
{ \
{ \
REGISTER_INFINIOP_TEST(gemm) \
REGISTER_INFINIOP_TEST(gemm) \
REGISTER_INFINIOP_TEST(random_sample) \
REGISTER_INFINIOP_TEST(random_sample) \
REGISTER_INFINIOP_TEST(mul) \
REGISTER_INFINIOP_TEST(mul)
\
}
}
namespace
infiniop_test
{
namespace
infiniop_test
{
...
...
src/infiniop-test/src/ops/mul.cpp
View file @
7569675e
...
@@ -40,10 +40,10 @@ std::shared_ptr<infiniop_test::Result> Test::run(
...
@@ -40,10 +40,10 @@ std::shared_ptr<infiniop_test::Result> Test::run(
auto
b
=
_attributes
->
b
->
to
(
device
,
device_id
);
auto
b
=
_attributes
->
b
->
to
(
device
,
device_id
);
auto
c
=
_attributes
->
c
->
to
(
device
,
device_id
);
auto
c
=
_attributes
->
c
->
to
(
device
,
device_id
);
CHECK_OR
(
infiniopCreateMulDescriptor
(
handle
,
&
op_desc
,
CHECK_OR
(
infiniopCreateMulDescriptor
(
handle
,
&
op_desc
,
c
->
desc
(),
c
->
desc
(),
a
->
desc
(),
a
->
desc
(),
b
->
desc
()),
b
->
desc
()),
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to create op descriptor."
));
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to create op descriptor."
));
size_t
workspace_size
;
size_t
workspace_size
;
CHECK_OR
(
infiniopGetMulWorkspaceSize
(
op_desc
,
&
workspace_size
),
CHECK_OR
(
infiniopGetMulWorkspaceSize
(
op_desc
,
&
workspace_size
),
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to get workspace size."
));
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to get workspace size."
));
...
@@ -51,12 +51,12 @@ std::shared_ptr<infiniop_test::Result> Test::run(
...
@@ -51,12 +51,12 @@ std::shared_ptr<infiniop_test::Result> Test::run(
CHECK_OR
(
infinirtMalloc
(
&
workspace
,
workspace_size
),
CHECK_OR
(
infinirtMalloc
(
&
workspace
,
workspace_size
),
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to allocate workspace."
));
return
TEST_FAILED
(
OP_CREATION_FAILED
,
"Failed to allocate workspace."
));
CHECK_OR
(
infiniopMul
(
op_desc
,
workspace
,
workspace_size
,
CHECK_OR
(
infiniopMul
(
op_desc
,
workspace
,
workspace_size
,
c
->
data
(),
c
->
data
(),
a
->
data
(),
a
->
data
(),
b
->
data
(),
b
->
data
(),
nullptr
),
nullptr
),
return
TEST_FAILED
(
OP_EXECUTION_FAILED
,
"Failed during execution."
));
return
TEST_FAILED
(
OP_EXECUTION_FAILED
,
"Failed during execution."
));
try
{
try
{
allClose
(
c
,
_attributes
->
ans
,
_rtol
,
_atol
);
allClose
(
c
,
_attributes
->
ans
,
_rtol
,
_atol
);
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
...
...
src/infiniop/ops/mul/cpu/mul_cpu.cc
View file @
7569675e
...
@@ -27,7 +27,7 @@ infiniStatus_t Descriptor::create(
...
@@ -27,7 +27,7 @@ infiniStatus_t Descriptor::create(
CREATE_ELEMENTWISE_CPU_DESCRIPTOR
(
handle
,
dtype
,
out_desc
,
input_desc_vec
);
CREATE_ELEMENTWISE_CPU_DESCRIPTOR
(
handle
,
dtype
,
out_desc
,
input_desc_vec
);
return
INFINI_STATUS_SUCCESS
;
return
INFINI_STATUS_SUCCESS
;
}
}
infiniStatus_t
Descriptor
::
calculate
(
infiniStatus_t
Descriptor
::
calculate
(
void
*
workspace
,
void
*
workspace
,
...
@@ -36,16 +36,16 @@ infiniStatus_t Descriptor::calculate(
...
@@ -36,16 +36,16 @@ infiniStatus_t Descriptor::calculate(
std
::
vector
<
const
void
*>
inputs
,
std
::
vector
<
const
void
*>
inputs
,
void
*
stream
)
const
{
void
*
stream
)
const
{
switch
(
_dtype
)
{
switch
(
_dtype
)
{
case
INFINI_DTYPE_F16
:
case
INFINI_DTYPE_F16
:
return
_device_info
->
calculate
<
MulOp
,
fp16_t
>
(
_info
,
output
,
inputs
,
stream
);
return
_device_info
->
calculate
<
MulOp
,
fp16_t
>
(
_info
,
output
,
inputs
,
stream
);
case
INFINI_DTYPE_F32
:
case
INFINI_DTYPE_F32
:
return
_device_info
->
calculate
<
MulOp
,
float
>
(
_info
,
output
,
inputs
,
stream
);
return
_device_info
->
calculate
<
MulOp
,
float
>
(
_info
,
output
,
inputs
,
stream
);
case
INFINI_DTYPE_F64
:
case
INFINI_DTYPE_F64
:
return
_device_info
->
calculate
<
MulOp
,
double
>
(
_info
,
output
,
inputs
,
stream
);
return
_device_info
->
calculate
<
MulOp
,
double
>
(
_info
,
output
,
inputs
,
stream
);
default:
default:
return
INFINI_STATUS_BAD_TENSOR_DTYPE
;
return
INFINI_STATUS_BAD_TENSOR_DTYPE
;
}
}
return
INFINI_STATUS_SUCCESS
;
return
INFINI_STATUS_SUCCESS
;
}
}
}
}
// namespace op::mul::cpu
src/infiniop/ops/mul/operator.cc
View file @
7569675e
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include "cuda/mul_cuda.cuh"
#include "cuda/mul_cuda.cuh"
#endif
#endif
__C
infiniStatus_t
infiniopCreateMulDescriptor
(
__C
infiniStatus_t
infiniopCreateMulDescriptor
(
infiniopHandle_t
handle
,
infiniopHandle_t
handle
,
infiniopMulDescriptor_t
*
desc_ptr
,
infiniopMulDescriptor_t
*
desc_ptr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment