@@ -236,3 +236,90 @@ def test_check_torchair_supported(self):
236236 for model_type , expected_output in test_cases :
237237 self .assertEqual (_check_torchair_supported (model_type ),
238238 expected_output )
239+
240+ @_clean_up_ascend_config
241+ def test_ascend_config_load_error (self ):
242+ test_vllm_config = VllmConfig ()
243+ # graph_batch_sizes should be list.
244+ with self .assertRaises (TypeError ):
245+ test_vllm_config .additional_config = {
246+ "torchair_graph_config" : {
247+ "graph_batch_sizes" : "fake_size" ,
248+ },
249+ "refresh" : True
250+ }
251+ init_ascend_config (test_vllm_config )
252+
253+ # graph_batch_sizes_init should not be True when graph_batch_sizes is not empty.
254+ with self .assertRaises (ValueError ):
255+ test_vllm_config .additional_config = {
256+ "torchair_graph_config" : {
257+ "graph_batch_sizes" : [1 , 2 , 4 , 8 ],
258+ "graph_batch_sizes_init" : True ,
259+ },
260+ "refresh" : True
261+ }
262+ init_ascend_config (test_vllm_config )
263+
264+ # torchair graph only works with deepseek.
265+ with self .assertRaises (NotImplementedError ):
266+ test_vllm_config .additional_config = {
267+ "torchair_graph_config" : {
268+ "enabled" : True ,
269+ },
270+ "refresh" : True
271+ }
272+ init_ascend_config (test_vllm_config )
273+ # torchair graph should not be enabled with eager mode
274+ with self .assertRaises (RuntimeError ):
275+ test_vllm_config .additional_config = {
276+ "torchair_graph_config" : {
277+ "enabled" : True ,
278+ },
279+ "refresh" : True
280+ }
281+ init_ascend_config (test_vllm_config )
282+
283+ # use_cached_graph should not be enabled without torchair graph mode
284+ with self .assertRaises (RuntimeError ):
285+ test_vllm_config .additional_config = {
286+ "torchair_graph_config" : {
287+ "enabled" : False ,
288+ "use_cached_graph" : True ,
289+ },
290+ "refresh" : True
291+ }
292+ init_ascend_config (test_vllm_config )
293+
294+ # graph_batch_sizes_init should not be enabled without torchair graph mode
295+ with self .assertRaises (RuntimeError ):
296+ test_vllm_config .additional_config = {
297+ "torchair_graph_config" : {
298+ "enabled" : False ,
299+ "graph_batch_sizes_init" : True ,
300+ },
301+ "refresh" : True
302+ }
303+ init_ascend_config (test_vllm_config )
304+
305+ # enable_multistream_mla should not be enabled without torchair graph mode
306+ with self .assertRaises (RuntimeError ):
307+ test_vllm_config .additional_config = {
308+ "torchair_graph_config" : {
309+ "enabled" : False ,
310+ "enable_multistream_mla" : True ,
311+ },
312+ "refresh" : True
313+ }
314+ init_ascend_config (test_vllm_config )
315+
316+ # enable_multistream_moe should not be enabled without torchair graph mode
317+ with self .assertRaises (RuntimeError ):
318+ test_vllm_config .additional_config = {
319+ "torchair_graph_config" : {
320+ "enabled" : False ,
321+ "enable_multistream_moe" : True ,
322+ },
323+ "refresh" : True
324+ }
325+ init_ascend_config (test_vllm_config )
0 commit comments