
    hV                     V    S SK r S SKrS SKrS SKrS SKrS SKrS SKrS\4S jrS r	S r
g)    Nreturnc                      [         R                  R                  5       (       a  [         R                  R                  5       $ [        R
                  " 5       $ )N)torchcudais_availableget_device_nameplatformmachine     O/home/james-whalen/.local/lib/python3.13/site-packages/torchao/_models/utils.pyget_arch_namer      s9    zz  zz))++ !!r   c                    [        U5       VVs0 s H
  u  p4X   U_M     nnnSSUS   US   US   US   US   S.S	.US
   SS/S.US   US   /US   S.S.n[        [        R                  R	                  U 5      S    S3S5       n[        [        R                  " U5      US9  SSS5        gs  snnf ! , (       d  f       g= f)a9  
Write the result into JSON format, so that it can be uploaded to the benchmark database
to be displayed on OSS dashboard. The JSON format is defined at
https://github.com/pytorch/pytorch/wiki/How-to-integrate-with-PyTorch-OSS-benchmark-database

OSS CI version, that will leave many fields to be filled in by CI
TorchAO benchmark	inferencedtypedevicearchmin_sqnrcompiler   r   r   r   namemoder   
extra_infor   modeltorchaor   typeoriginsmetricactualtargetr   benchmark_valuestarget_value)	benchmarkr   r!   r   .jsonafileN)	enumerateopenospathsplitextprintjsondumps)output_json_pathheadersrowivmapping_headersrecordfs           r   write_json_result_osscir<      s     2;3@wz1}O@ ($W-)(3'/+J7*95	
 $F+!{
 $H-!0!: ;+H5
%F2 
!!"23A67u=s	Cqdjj q) 
D	C5 A4 
D	Cs   B/B55
Cc                 6   [        U5       VVs0 s H
  u  p4X   U_M     nnn[        R                  R                  5       n[        R
                  " [        U5      R                  S5      5      R                  5       n[        R                  R                  U[        R                  R                  5      n[        UR                  5       5      n	U	S-   n
[        [        R                  " 5       5      SSSSUU	SU
SSUS	   US
   US   US   US   S.S.US   SS/S.US   US   /US   S.S.n[        [        R                   R#                  U 5      S    S3S5       n[%        [&        R(                  " U5      US9  SSS5        gs  snnf ! , (       d  f       g= f)aI  
Write the result into JSON format, so that it can be uploaded to the benchmark database
to be displayed on OSS dashboard. The JSON format is defined at
https://github.com/pytorch/pytorch/wiki/How-to-integrate-with-PyTorch-OSS-benchmark-database

Local version (filling in dummy values for fields that should be populated by CI)
zutf-8   v3zdevvm local benchmarkz
pytorch/aomainr   r   r   r   r   r   r   r   r   r   r   r   r   r!   r"   r#   r$   )	timestampschema_versionr   repohead_branchhead_shaworkflow_idrun_attemptjob_idr'   r   r!   r   r(   r)   r*   N)r,   datetimedatetodayhashlibsha256strencode	hexdigestcombinetimeminintrA   r-   r.   r/   r0   r1   r2   r3   )r4   r5   r6   r7   r8   r9   rK   sha_hashfirst_secondrF   rH   r:   r;   s                r   write_json_result_localrW   >   s    2;3@wz1}O@MM!E~~c%j//89CCEH$$,,UHMM4E4EFLl,,./K1_F%'"'$W-)(3'/+J7*95	
 $F+!{
 $H-!0!: ;+H5
7 FD 
!!"23A67u=s	Cqdjj q) 
D	CQ AP 
D	Cs   FF


F)rI   rL   r2   r.   r	   rR   r   rN   r   r<   rW   r   r   r   <module>rX      s3       	   "s "#*L1*r   