File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -661,6 +661,12 @@ <h2>Comparison Charts</h2>
661661 const info = JSON . parse ( flareEngine . backend_info ( ) ) ;
662662 console . log ( '[Flare] backend_info:' , info ) ;
663663 log ( `Flare backend: ${ JSON . stringify ( info ) } ` , gpuOk ? 'success' : 'info' ) ;
664+ // Prefill profiling — captures per-layer timing
665+ flareEngine . enable_prefill_profiling ( ) ;
666+ const profile = JSON . parse ( flareEngine . prefill_profile_json ( ) ) ;
667+ console . log ( '[Flare] prefill profile:' , profile ) ;
668+ log ( `Flare prefill profile: ${ JSON . stringify ( profile ) } ` , 'info' ) ;
669+ flareEngine . disable_prefill_profiling ( ) ;
664670 } catch ( e ) {
665671 console . warn ( '[Flare] GPU init failed:' , e ) ;
666672 log ( 'Flare GPU init failed — using CPU SIMD' , 'info' ) ;
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ interface FlareEngineInstance {
6060 add_stop_sequence ( seq : string ) : void ;
6161 clear_stop_sequences ( ) : void ;
6262 backend_info ( ) : string ;
63+ enable_prefill_profiling ( ) : void ;
64+ disable_prefill_profiling ( ) : void ;
65+ prefill_profile_json ( ) : string ;
6366}
6467
6568interface FlareModule {
@@ -311,7 +314,11 @@ export class FlareEngineWrapper {
311314 if ( useGpu ) {
312315 try {
313316 this . gpuEnabled = await this . engine . init_gpu ( ) ;
314- console . log ( '[Flare]' , JSON . parse ( this . engine . backend_info ( ) ) ) ;
317+ console . log ( '[Flare] backend_info:' , JSON . parse ( this . engine . backend_info ( ) ) ) ;
318+ // Prefill profiling — captures per-layer timing for the first run
319+ this . engine . enable_prefill_profiling ( ) ;
320+ console . log ( '[Flare] prefill profile:' , JSON . parse ( this . engine . prefill_profile_json ( ) ) ) ;
321+ this . engine . disable_prefill_profiling ( ) ;
315322 if ( ! this . gpuEnabled ) {
316323 console . info ( '[Flare] WebGPU unavailable — using CPU SIMD path' ) ;
317324 }
You can’t perform that action at this time.
0 commit comments