!44143 [profiler] fix parameter type error description

Merge pull request !44143 from zangqx/m_ascend_timeline
This commit is contained in:
i-robot 2022-10-20 06:38:38 +00:00 committed by Gitee
commit 9998d6dbde
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 8 deletions

View File

@ -17,7 +17,7 @@ mindspore.Profiler
- 1: PipeUtilization包含vec_ratio、mac_ratio、scalar_ratio、mte1/mte2/mte3_ratio、icache_miss_rate等。
- 2: Memory包含ub\_read/write_bw、l1_read/write_bw、l2_read/write_bw、main_mem_read/write_bw等。
- 3: MemoryL0包含l0a_read/write_bw、l0b_read/write_bw、l0c_read/write_bw等。
- 4: ResourceConflictRatio包含vec_bankgroup/bank/resc_cflt_ratio、mte1/mte2/mte3_iq_full_ratio、cube/vec_full_ratio等。
- 4: ResourceConflictRatio包含vec_bankgroup/bank/resc_cflt_ratio等。
- 5: MemoryUB包含ub\_read/write_bw_mte, ub\_read/write_bw_vector, ub\_/write_bw_scalar等。
- **l2_cache** (bool, 可选) - 仅限Ascend是否收集l2缓存数据当值为True时收集这些数据。默认值False。

View File

@ -84,8 +84,7 @@ class Profiler:
etc.
- 2: Memory contains ub_read/write_bw, l1_read/write_bw, l2_read/write_bw, main_mem_read/write_bw etc.
- 3: MemoryL0 contains l0a_read/write_bw, l0b_read/write_bw, l0c_read/write_bw etc.
- 4: ResourceConflictRatio contains vec_bankgroup/bank/resc_cflt_ratio, mte1/mte2/mte3_iq_full_ratio,
cube/vec_full_ratio ect.
- 4: ResourceConflictRatio contains vec_bankgroup/bank/resc_cflt_ratio etc.
- 5: MemoryUB contains ub_read/write_bw_mte, ub_read/write_bw_vector, ub_/write_bw_scalar etc.
l2_cache (bool, optional): (Ascend only) Whether to collect l2 cache data, collect when True. Default: False.
@ -620,7 +619,7 @@ class Profiler:
raise TypeError(f"For '{self.__class__.__name__}', the parameter profile_memory must be bool, "
f"but got type '{type(self._profile_memory)}'")
if kwargs:
logger.warning("There are invalid params which don't work.")
logger.warning("%s are invalid params which don't work.", kwargs)
task_sink = os.getenv("GRAPH_OP_RUN")
if task_sink and task_sink == "1":
@ -1249,13 +1248,17 @@ class Profiler:
def _parser_kwargs(self, kwargs):
"""Parse kwargs vale."""
self._aicore_metrics_id = kwargs.pop("aicore_metrics", 0)
if not isinstance(self._aicore_metrics_id, int) or self._aicore_metrics_id not in self._aicore_metrics_dict:
logger.warning("aicore_metrics is an invalid value, it will be set to 0.")
self._aicore_metrics_id = 0
if not isinstance(self._aicore_metrics_id, int):
raise TypeError(f"For '{self.__class__.__name__}', the parameter aicore_metrics must be int, "
f"but got type {type(self._aicore_metrics_id)}")
if self._aicore_metrics_id not in self._aicore_metrics_dict:
raise ValueError(f"For '{self.__class__.__name__}', the parameter aicore_metrics must be in "
f"[-1, 0, 1, 2, 3, 4, 5], but got {self._aicore_metrics_id}")
l2_cache_enable = kwargs.pop("l2_cache", False)
if not isinstance(l2_cache_enable, bool):
logger.warning("l2_cache is an invalid value, it will be set to False.")
raise TypeError(f"For '{self.__class__.__name__}', the parameter l2_cache must be bool, "
f"but got type {type(l2_cache_enable)}")
if l2_cache_enable:
self._l2_cache = "on"