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
OpenDAS
MMCV
Commits
be684eeb
Unverified
Commit
be684eeb
authored
Oct 18, 2022
by
bdf
Committed by
GitHub
Oct 18, 2022
Browse files
[Feature] Add getJobLimitCapability interface and use it in nms (#2337)
Co-authored-by:
budefei
<
budefei@cambricon.com
>
parent
bd1da5ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
mmcv/ops/csrc/common/pytorch_mlu_helper.hpp
mmcv/ops/csrc/common/pytorch_mlu_helper.hpp
+10
-0
mmcv/ops/csrc/pytorch/mlu/nms_mlu.cpp
mmcv/ops/csrc/pytorch/mlu/nms_mlu.cpp
+1
-2
No files found.
mmcv/ops/csrc/common/pytorch_mlu_helper.hpp
View file @
be684eeb
...
@@ -25,6 +25,16 @@
...
@@ -25,6 +25,16 @@
#define CEIL_ALIGN(x, y) (((x) + (y)-1) / (y) * (y))
#define CEIL_ALIGN(x, y) (((x) + (y)-1) / (y) * (y))
inline
int32_t
getJobLimitCapability
()
{
CNcontext
drv_ctx
;
CNctxConfigParam
ctx_conf_param
;
TORCH_CHECK
(
CN_SUCCESS
==
cnGetCtxConfigParam
(
drv_ctx
,
CN_CTX_CONFIG_UNION_LIMIT
,
&
ctx_conf_param
),
"cnGetCtxConfigParam fails."
);
return
(
int32_t
)
ctx_conf_param
.
unionLimit
;
}
#endif // MMCV_WITH_MLU
#endif // MMCV_WITH_MLU
#endif // PYTORCH_MLU_HELPER_HPP_
#endif // PYTORCH_MLU_HELPER_HPP_
mmcv/ops/csrc/pytorch/mlu/nms_mlu.cpp
View file @
be684eeb
...
@@ -34,8 +34,7 @@ static cnnlStatus_t policyFunc(cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type,
...
@@ -34,8 +34,7 @@ static cnnlStatus_t policyFunc(cnrtDim3_t *k_dim, cnrtFunctionType_t *k_type,
int
&
core_num_per_class
,
int
&
core_num_per_class
,
const
int
input_box_num
)
{
const
int
input_box_num
)
{
uint32_t
core_dim
=
torch_mlu
::
getDeviceAttr
(
cnrtAttrMcorePerCluster
);
uint32_t
core_dim
=
torch_mlu
::
getDeviceAttr
(
cnrtAttrMcorePerCluster
);
uint32_t
cluster_number
=
torch_mlu
::
getDeviceAttr
(
cnrtAttrClusterCount
);
uint32_t
job_limit
=
getJobLimitCapability
();
uint32_t
job_limit
=
cluster_number
*
core_dim
;
uint32_t
core_number
=
job_limit
;
uint32_t
core_number
=
job_limit
;
int
box_num_per_core
=
(
input_box_num
+
core_number
-
1
)
/
core_number
;
int
box_num_per_core
=
(
input_box_num
+
core_number
-
1
)
/
core_number
;
...
...
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