@@ -257,16 +257,19 @@ def detect_xrt(
257257 run_on_npu = f"{ aie_src_root } /utils/run_on_npu.sh"
258258
259259 # Map model to NPU generation and filter by available components
260+ # Convert vitis_components to uppercase for case-insensitive comparison
261+ vitis_components_upper = [c .upper () for c in vitis_components ]
262+
260263 if model in LitConfigHelper .NPU_MODELS ["npu1" ]:
261- if "aie2 " in vitis_components :
264+ if "AIE2 " in vitis_components_upper :
262265 run_on_npu1 = run_on_npu
263266 config .features .extend (["ryzen_ai" , "ryzen_ai_npu1" ])
264267 config .substitutions ["%run_on_npu1%" ] = run_on_npu1
265268 print (f"Running tests on NPU1 with command line: { run_on_npu1 } " )
266269 else :
267270 print ("NPU1 detected but aietools for aie2 not available" )
268271 elif model in LitConfigHelper .NPU_MODELS ["npu2" ]:
269- if "aie2p " in vitis_components :
272+ if "AIE2P " in vitis_components_upper :
270273 run_on_npu2 = run_on_npu
271274 config .features .extend (["ryzen_ai" , "ryzen_ai_npu2" ])
272275 config .substitutions ["%run_on_npu2%" ] = run_on_npu2
@@ -352,15 +355,17 @@ def detect_peano(
352355 peano_tools_dir : str , peano_install_dir : str , llvm_config
353356 ) -> HardwareConfig :
354357 """
355- Detect Peano backend availability.
358+ Detect Peano backend availability and supported AIE architectures .
356359
357360 Args:
358361 peano_tools_dir: Path to Peano tools directory
359362 peano_install_dir: Path to Peano installation root
360363 llvm_config: LLVM lit config object for environment setup
361364
362365 Returns:
363- HardwareConfig with Peano detection results
366+ HardwareConfig with Peano detection results including supported AIE architectures.
367+ The supported architectures are stored in config.substitutions["%peano_components%"]
368+ as a list that can be added to vitis_components.
364369 """
365370 config = HardwareConfig ()
366371
@@ -373,15 +378,43 @@ def detect_peano(
373378 timeout = 5 ,
374379 )
375380
376- if re .search (
377- "Xilinx AI Engine" , result .stdout .decode ("utf-8" , errors = "ignore" )
378- ):
381+ version_output = result .stdout .decode ("utf-8" , errors = "ignore" )
382+ if re .search ("Xilinx AI Engine" , version_output ):
379383 config .found = True
380384 config .features .append ("peano" )
381385 config .substitutions ["%PEANO_INSTALL_DIR" ] = peano_install_dir
382386 # Also set environment variable for tests that need it
383387 llvm_config .with_environment ("PEANO_INSTALL_DIR" , peano_install_dir )
384388 print (f"Peano found: { llc_path } " )
389+
390+ # Detect supported AIE architectures by checking include directories
391+ # llvm-aie installed via pip will have include dirs like:
392+ # - aie2-none-unknown-elf/
393+ # - aie2p-none-unknown-elf/
394+ supported_components = []
395+ peano_include_dir = os .path .join (peano_install_dir , "include" )
396+
397+ if os .path .isdir (peano_include_dir ):
398+ # Check for AIE2 support
399+ aie2_include = os .path .join (peano_include_dir , "aie2-none-unknown-elf" )
400+ if os .path .isdir (aie2_include ):
401+ supported_components .append ("AIE2" )
402+ config .features .append ("peano_aie2" )
403+ print (" Peano supports AIE2" )
404+
405+ # Check for AIE2P support
406+ aie2p_include = os .path .join (peano_include_dir , "aie2p-none-unknown-elf" )
407+ if os .path .isdir (aie2p_include ):
408+ supported_components .append ("AIE2P" )
409+ config .features .append ("peano_aie2p" )
410+ print (" Peano supports AIE2P" )
411+
412+ # Store supported components as a Python list string for lit config
413+ if supported_components :
414+ config .substitutions ["%peano_components%" ] = str (supported_components )
415+ else :
416+ config .substitutions ["%peano_components%" ] = "[]"
417+
385418 return config
386419 except subprocess .TimeoutExpired :
387420 print (f"Peano detection timed out at { peano_tools_dir } " )
@@ -391,6 +424,7 @@ def detect_peano(
391424 print (f"Peano detection failed: { e } " )
392425
393426 print (f"Peano not found, but expected at { peano_tools_dir } " )
427+ config .substitutions ["%peano_components%" ] = "[]"
394428 return config
395429
396430 @staticmethod
0 commit comments