Lula GPU test - DO NOT CLOSE until 25th march#564
Lula GPU test - DO NOT CLOSE until 25th march#564Kwame Yeboah (Yeboahmedia) wants to merge 4 commits intomainfrom
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the MediaPipe initialization logic in the web-components selfie capture flow to choose a CPU vs GPU delegate based on detected GPU characteristics (targeting Adreno devices) rather than device-model checks.
Changes:
- Added WebGL-based GPU renderer detection and exclusion matching.
- Added UA-CH high-entropy hint collection as a secondary detection signal.
- Wired the new delegate-selection logic into
FaceLandmarker.createFromOptions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if (isExcludedGpuFromWebGL()) { | ||
| alert(`[SmileID] Excluded GPU via WebGL: ${renderer}. Using CPU.`); | ||
| return 'CPU'; | ||
| } | ||
|
|
||
| // Secondary check: UA-CH hints (may contain GPU info in some browsers) | ||
| const hintString = await getSystemArchitectureHints(); | ||
|
|
||
| if (hintString) { | ||
| const normalizedHintString = hintString.replace(/[\s_-]/g, ''); | ||
|
|
||
| const hasExcludedGpuInHints = | ||
| EXCLUDED_GPUS.some((gpu) => | ||
| normalizedHintString.includes(gpu.toLowerCase().replace(/[\s_-]/g, '')), | ||
| ) || /adreno8\d{2}/.test(normalizedHintString); | ||
|
|
||
| if (hasExcludedGpuInHints) { | ||
| alert( | ||
| `[SmileID] Excluded GPU via UA-CH hints: ${hintString}. Using CPU.`, | ||
| ); | ||
| return false; | ||
| return 'CPU'; | ||
| } | ||
| } | ||
| // If API is not supported, return false (rely on synchronous isExcludedDevice) | ||
| return false; | ||
|
|
||
| // Default to GPU when no exclusion is detected | ||
| alert( | ||
| `[SmileID] No excluded GPU detected. WebGL renderer: ${renderer ?? 'unavailable'}, UA-CH: ${hintString ?? 'unavailable'}. Using GPU.`, | ||
| ); |
| return ( | ||
| EXCLUDED_GPUS.some((gpu) => | ||
| normalizedRenderer.includes(gpu.toLowerCase().replace(/[\s_-]/g, '')), | ||
| ) || /adreno8\d{2}/.test(normalizedRenderer) |
Co-authored-by: prfectionist[bot] <187910262+prfectionist[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
This branch has been deployed to s3 / cloudfront. ✅ Preview URL for Smart Camera Web: ✅ Preview URL for Embed: ✅ Preview URL for Web Client (Sandbox): ✅ Preview URL for Web Client (Production): |
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
PR Type
Enhancement
Description
Replace device model-based exclusion with GPU renderer detection
Use WebGL debug info as primary GPU detection method
Add UA-CH architecture hints as secondary fallback
Debug
alert()calls left in for testing purposesDiagram Walkthrough
File Walkthrough
mediapipeManager.ts
GPU-based exclusion detection replacing device model checkspackages/web-components/lib/components/selfie/src/smartselfie-capture/utils/mediapipeManager.ts
EXCLUDED_DEVICES(device model strings) withEXCLUDED_GPUS(Adreno GPU identifiers like
adreno-830,adreno-8xx,adreno-9xx)getGpuRenderer()to query GPU renderer via WebGLWEBGL_debug_renderer_infoextensionisExcludedGpuFromWebGL()to check if the detected GPU matchesexclusion list, including regex for Adreno 8xx series
isExcludedDeviceUsingHints()withgetSystemArchitectureHints()that fetches broader UA-CH hints(architecture, model, platform, etc.)
getDelegateFromGpuDetection()combining WebGL (primary) andUA-CH (secondary) checks to determine CPU vs GPU delegate
alert()calls that should be removed before merginggetMediapipeInstanceto use newgetDelegateFromGpuDetection()for delegate selection