已合并
【feat】新增第三批sk_options并更新autofusion commit id #36333
mihudan创建于 5月21日
【feat】新增第三批sk_options并更新autofusion commit id #36333
已合并
mihudan创建于 5月21日
4 个文件变更+76-3
@@ -194,6 +194,13 @@ class TestAclgraphSuperKernelOptimize(TestCase):
194 debug_options={'debug_extend': 123}194 debug_options={'debug_extend': 123}
195 )195 )
196 196 
197+ # debug_per_op_max_core_num expects int, not str
198+ with self.assertRaises(RuntimeError):
199+ g.super_kernel_optimize(
200+ optimize_options=None,
201+ debug_options={'debug_per_op_max_core_num': 'invalid'}
202+ )
203+ 
197 # dcci_before_kernel_start expects list, not int204 # dcci_before_kernel_start expects list, not int
198 with self.assertRaises(RuntimeError):205 with self.assertRaises(RuntimeError):
199 g.super_kernel_optimize(206 g.super_kernel_optimize(
@@ -208,6 +215,20 @@ class TestAclgraphSuperKernelOptimize(TestCase):
208 debug_options=None215 debug_options=None
209 )216 )
210 217 
218+ # early_start expects int, not str
219+ with self.assertRaises(RuntimeError):
220+ g.super_kernel_optimize(
221+ optimize_options={'early_start': 'invalid'},
222+ debug_options=None
223+ )
224+ 
225+ # ubuf_lock_ignore_kernel expects list, not int
226+ with self.assertRaises(RuntimeError):
227+ g.super_kernel_optimize(
228+ optimize_options={'ubuf_lock_ignore_kernel': 1},
229+ debug_options=None
230+ )
231+ 
211 def test_aggressive_opt_strategies_sub_option_type_validation(self):232 def test_aggressive_opt_strategies_sub_option_type_validation(self):
212 """Test aggressive_opt_strategies sub-option type validation"""233 """Test aggressive_opt_strategies sub-option type validation"""
213 torch.npu.set_device(0)234 torch.npu.set_device(0)
@@ -267,6 +288,26 @@ class TestAclgraphSuperKernelOptimize(TestCase):
267 debug_options=None288 debug_options=None
268 )289 )
269 290 
291+ def test_ubuf_lock_ignore_kernel_element_type_validation(self):
292+ """Test ubuf_lock_ignore_kernel list element type validation"""
293+ torch.npu.set_device(0)
294+ 
295+ g = torch.npu.NPUGraph()
296+ 
297+ # ubuf_lock_ignore_kernel list element expects str, not int
298+ with self.assertRaises(RuntimeError):
299+ g.super_kernel_optimize(
300+ optimize_options={'ubuf_lock_ignore_kernel': [123, 'valid']},
301+ debug_options=None
302+ )
303+ 
304+ # ubuf_lock_ignore_kernel list element expects str, not None
305+ with self.assertRaises(RuntimeError):
306+ g.super_kernel_optimize(
307+ optimize_options={'ubuf_lock_ignore_kernel': ['valid', None]},
308+ debug_options=None
309+ )
310+ 
270 311 
271class TestAclgraphSuperKernelIntegration(TestCase):312class TestAclgraphSuperKernelIntegration(TestCase):
272 313 
@@ -299,12 +340,15 @@ class TestAclgraphSuperKernelIntegration(TestCase):
299 'event_breaker_bypass': 1,340 'event_breaker_bypass': 1,
300 'value_breaker_bypass': 1,341 'value_breaker_bypass': 1,
301 'task_breaker_bypass': 1342 'task_breaker_bypass': 1
302- }343+ },
344+ 'ubuf_lock_ignore_kernel': [],
345+ 'early_start': 1
303 }346 }
304 debug_options = {347 debug_options = {
305 'debug_sync_all': 1,348 'debug_sync_all': 1,
306 'debug_op_exec_trace': 1,349 'debug_op_exec_trace': 1,
307- 'debug_cross_core_sync_check': 1350+ 'debug_cross_core_sync_check': 1,
351+ 'debug_per_op_max_core_num': 1
308 }352 }
309 353 
310 g.super_kernel_optimize(optimize_options=optimize_options, debug_options=debug_options)354 g.super_kernel_optimize(optimize_options=optimize_options, debug_options=debug_options)
@@ -1 +1 @@
1-Subproject commit 6ff8fe3b4722857da8ceeef10c026b88f0997f831+Subproject commit ea356604ae2ba09aab0e53c866a7057c7d35115e
@@ -383,6 +383,14 @@ public:
383 {"debug_cross_core_sync_check", [](aclskOption& opt, int val) {383 {"debug_cross_core_sync_check", [](aclskOption& opt, int val) {
384 opt.optionType = aclskOptionType::DEBUG_CROSS_CORE_SYNC_CHECK;384 opt.optionType = aclskOptionType::DEBUG_CROSS_CORE_SYNC_CHECK;
385 opt.debugCrossCoreSyncCheck.enableCrossCoreSyncCheck = static_cast<uint32_t>(val);385 opt.debugCrossCoreSyncCheck.enableCrossCoreSyncCheck = static_cast<uint32_t>(val);
386+ }},
387+ {"early_start", [](aclskOption& opt, int val) {
388+ opt.optionType = aclskOptionType::EARLY_START;
389+ opt.earlyStart.enableEarlyStart = static_cast<uint32_t>(val);
390+ }},
391+ {"debug_per_op_max_core_num", [](aclskOption& opt, int val) {
392+ opt.optionType = aclskOptionType::DEBUG_PER_OP_MAX_CORE_NUM;
393+ opt.debugPerOpMaxCoreNum.enableDebugPerOpMaxCoreNum = static_cast<uint32_t>(val);
386 }}394 }}
387 };395 };
388 396 
@@ -402,6 +410,8 @@ public:
402 processDcciBeforeKernelStart(values);410 processDcciBeforeKernelStart(values);
403 } else if (key == "dcci_after_kernel_end") {411 } else if (key == "dcci_after_kernel_end") {
404 processDcciAfterKernelEnd(values);412 processDcciAfterKernelEnd(values);
413+ } else if (key == "ubuf_lock_ignore_kernel") {
414+ processUbufLockIgnoreKernel(values);
405 }415 }
406 }416 }
407 417 
@@ -481,6 +491,15 @@ private:
481 optionsVec.push_back(opt);491 optionsVec.push_back(opt);
482 }492 }
483 493 
494+ void processUbufLockIgnoreKernel(const std::vector<std::string>& values)
495+ {
496+ aclskOption opt = {};
497+ opt.optionType = aclskOptionType::UBUF_LOCK_IGNORE_KERNEL;
498+ opt.ubufLockIgnoreKernel.ubufLockIgnoreKernelCnt = static_cast<int>(values.size());
499+ opt.ubufLockIgnoreKernel.ubufLockIgnoreKernel = convertStringArray(values);
500+ optionsVec.push_back(opt);
501+ }
502+ 
484 char** convertStringArray(const std::vector<std::string>& values)503 char** convertStringArray(const std::vector<std::string>& values)
485 {504 {
486 std::vector<char*> charPtrs;505 std::vector<char*> charPtrs;
@@ -744,6 +744,13 @@ class NPUGraph(torch_npu._C._NPUGraph):
744 'value_breaker_bypass': {'value_type': int},744 'value_breaker_bypass': {'value_type': int},
745 'task_breaker_bypass': {'value_type': int}745 'task_breaker_bypass': {'value_type': int}
746 }746 }
747+ },
748+ 'ubuf_lock_ignore_kernel': {
749+ 'value_type': list,
750+ 'element_type': str
751+ },
752+ 'early_start': {
753+ 'value_type': int
747 }754 }
748 },755 },
749 'debug_options': {756 'debug_options': {
@@ -758,6 +765,9 @@ class NPUGraph(torch_npu._C._NPUGraph):
758 },765 },
759 'debug_extend': {766 'debug_extend': {
760 'value_type': str767 'value_type': str
768+ },
769+ 'debug_per_op_max_core_num': {
770+ 'value_type': int
761 }771 }
762 }772 }
763 }773 }