fix: breakpad use miniz
Some checks failed
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 1m34s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Successful in 2m46s
sm-rpc / build (Debug, host.gcc) (push) Failing after 1m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Successful in 2m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Successful in 2m8s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m35s
sm-rpc / build (Release, host.gcc) (push) Failing after 1m55s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Successful in 7m21s

This commit is contained in:
tqcq
2025-08-25 15:24:22 +08:00
parent a58517497b
commit 68b2e7f763
728 changed files with 489652 additions and 1211 deletions

64
third_party/tracy/extra/color-hot.cpp vendored Normal file
View File

@@ -0,0 +1,64 @@
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
inline float linear2sRGB( float v )
{
float s1 = sqrt( v );
float s2 = sqrt( s1 );
float s3 = sqrt( s2 );
return 0.585122381f * s1 + 0.783140355f * s2 - 0.368262736f * s3;
}
float lerp( float v0, float v1, float t )
{
return ( 1-t ) * v0 + t * v1;
}
inline float sRGB2linear( float v )
{
return v * ( v * ( v * 0.305306011f + 0.682171111f ) + 0.012522878f );
}
int main()
{
int c0 = 0x3333FF;
int c1 = 0x33FF33;
uint32_t t[256] = {};
float r0 = ( c0 & 0xFF ) / 255.f;
float r1 = ( c1 & 0xFF ) / 255.f;
float g0 = ( ( c0 >> 8 ) & 0xFF ) / 255.f;
float g1 = ( ( c1 >> 8 ) & 0xFF ) / 255.f;
float b0 = ( ( c0 >> 16 ) & 0xFF ) / 255.f;
float b1 = ( ( c1 >> 16 ) & 0xFF ) / 255.f;
for( int i=0; i<256; i++ )
{
float m = i / 255.f;
float rf = linear2sRGB( lerp( sRGB2linear( r0 ), sRGB2linear( r1 ), m ) );
float gf = linear2sRGB( lerp( sRGB2linear( g0 ), sRGB2linear( g1 ), m ) );
float bf = linear2sRGB( lerp( sRGB2linear( b0 ), sRGB2linear( b1 ), m ) );
int r = (int)std::clamp( rf * 255.f, 0.f, 255.f );
int g = (int)std::clamp( gf * 255.f, 0.f, 255.f );
int b = (int)std::clamp( bf * 255.f, 0.f, 255.f );
t[i] = 0xFF000000 | ( b << 16 ) | ( g << 8 ) | r;
}
printf( "uint32_t GoodnessColor[256] = {\n" );
for( int i=0; i<256; i += 8 )
{
printf( " " );
for( int j=i; j<i+8; j++ )
{
printf( " 0x%X,", t[j] );
}
printf( "\n" );
}
printf( "};\n" );
}

77
third_party/tracy/extra/color.cpp vendored Normal file
View File

@@ -0,0 +1,77 @@
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <math.h>
inline float sqrtfast( float v )
{
union
{
int i;
float f;
} u;
u.f = v;
u.i -= 1 << 23;
u.i >>= 1;
u.i += 1 << 29;
return u.f;
}
inline float linear2sRGB( float v )
{
float s1 = sqrtfast( v );
float s2 = sqrtfast( s1 );
float s3 = sqrtfast( s2 );
return 0.585122381f * s1 + 0.783140355f * s2 - 0.368262736f * s3;
}
int lerp( int v0, int v1, float t )
{
return int( ( 1-t ) * v0 + t * v1 );
}
inline float sRGB2linear( float v )
{
return v * ( v * ( v * 0.305306011f + 0.682171111f ) + 0.012522878f );
}
int main()
{
int c0 = std::min( 255, int( sRGB2linear( 1.f ) * 255 ) );
int c1 = std::min( 255, int( sRGB2linear( 0x44 / 255.f ) * 255 ) );
int s0 = std::min( 255, int( sRGB2linear( 1.f ) * 255 * 0.5 ) );
int s1 = std::min( 255, int( sRGB2linear( 0x44 / 255.f ) * 255 * 0.5 ) );
float target = 80.f;
uint32_t t[256];
memset( t, 0, sizeof( uint32_t ) * 256 );
for( int i=1; i<128; i++ )
{
float m = (i-1) / target;
int l0 = std::min( 255, lerp( s0, c0, m ) );
int l1 = std::min( 255, lerp( s1, c1, m ) );
int g0 = std::min( 255, int( linear2sRGB( l0/255.f ) * 255 ) );
int g1 = std::min( 255, int( linear2sRGB( l1/255.f ) * 255 ) );
g0 = l0;
g1 = l1;
t[i] = 0xFF000000 | ( g1 << 16 ) | ( g0 << 8 ) | g1;
t[uint8_t(-i)] = 0xFF000000 | ( g1 << 16 ) | ( g1 << 8 ) | g0;
}
printf( "uint32_t MemDecayColor[256] = {\n" );
for( int i=0; i<256; i += 8 )
{
printf( " " );
for( int j=i; j<i+8; j++ )
{
printf( " 0x%X,", t[j] );
}
printf( "\n" );
}
printf( "};\n" );
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/tracy">
<comment>Tracy Profiler trace file</comment>
<comment xml:lang="pl">Zrzut sesji profilera Tracy</comment>
<icon name="application-tracy"/>
<magic>
<match type="string" value="tlZ\x04" offset="0"/>
<match type="string" value="tZst" offset="0"/>
<match type="string" value="tr\xFDP" offset="0"/>
</magic>
<glob pattern="*.tracy"/>
</mime-type>
</mime-info>

View File

@@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Tracy Profiler
GenericName=Code profiler
GenericName[pl]=Profiler kodu
Comment=Examine code to see where it is slow
Comment[pl]=Znajdowanie wolno wykonującego się kodu
Exec=/usr/bin/tracy %f
Icon=tracy
Terminal=false
Categories=Development;Profiling;
MimeType=application/tracy;

22
third_party/tracy/extra/dxt1divtable.c vendored Normal file
View File

@@ -0,0 +1,22 @@
#include <stdint.h>
#include <stdio.h>
int main()
{
for( int i=0; i<255*3+1; i++ )
{
// replace 4 with 2 for ARM NEON table
uint32_t range = ( 4 << 16 ) / ( 1+i );
if( range > 0xFFFF ) range = 0xFFFF;
if( i % 16 == 15 )
{
printf( "0x%04x,\n", range );
}
else
{
printf( "0x%04x, ", range );
}
}
printf( "\n" );
return 0;
}

36
third_party/tracy/extra/dxt1table.c vendored Normal file
View File

@@ -0,0 +1,36 @@
#include <stdint.h>
#include <stdio.h>
static const uint8_t IndexTable[4] = { 1, 3, 2, 0 };
int convert( int v )
{
int v0 = v & 0x3;
int v1 = ( v >> 2 ) & 0x3;
int v2 = ( v >> 4 ) & 0x3;
int v3 = ( v >> 6 );
int t0 = IndexTable[v0];
int t1 = IndexTable[v1];
int t2 = IndexTable[v2];
int t3 = IndexTable[v3];
return t0 | ( t1 << 2 ) | ( t2 << 4 ) | ( t3 << 6 );
}
int main()
{
for( int i=0; i<256; i++ )
{
if( i % 16 == 15 )
{
printf( "%i,\n", convert( i ) );
}
else
{
printf( "%i,\t", convert( i ) );
}
}
printf( "\n" );
return 0;
}

50
third_party/tracy/extra/identify.cpp vendored Normal file
View File

@@ -0,0 +1,50 @@
// g++ identify.cpp -lpthread ../public/common/tracy_lz4.cpp ../zstd/common/*.c ../zstd/decompress/*.c ../zstd/decompress/huf_decompress_amd64.S
#include <memory>
#include <stdint.h>
#include <stdio.h>
#include "../server/TracyFileRead.hpp"
#include "../public/common/TracyVersion.hpp"
static const uint8_t FileHeader[8] { 't', 'r', 'a', 'c', 'y', tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch };
enum { FileHeaderMagic = 5 };
int main( int argc, char** argv )
{
if( argc != 2 )
{
fprintf( stderr, "Usage: %s trace\n", argv[0] );
return -1;
}
try
{
std::unique_ptr<tracy::FileRead> f( tracy::FileRead::Open( argv[1] ) );
if( !f )
{
fprintf( stderr, "%s: Cannot open!\n", argv[1] );
return -2;
}
uint8_t hdr[8];
f->Read( hdr, sizeof( hdr ) );
if( memcmp( FileHeader, hdr, FileHeaderMagic ) != 0 )
{
fprintf( stderr, "%s: Bad header!\n", argv[1] );
return -3;
}
printf( "%s: %i.%i.%i\n", argv[1], hdr[FileHeaderMagic], hdr[FileHeaderMagic+1], hdr[FileHeaderMagic+2] );
}
catch( const tracy::NotTracyDump& )
{
fprintf( stderr, "%s: Not a tracy dump!\n", argv[1] );
return -4;
}
catch( const tracy::FileReadError& )
{
fprintf( stderr, "%s: File read error!\n", argv[1] );
return -5;
}
}

26
third_party/tracy/extra/make-build.sh vendored Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
rm -rf tracy-build
mkdir tracy-build
./update-meson-version.sh
if [ ! -f vswhere.exe ]; then
wget https://github.com/microsoft/vswhere/releases/download/2.8.4/vswhere.exe
fi
MSVC=`./vswhere.exe -property installationPath -version '[17.0,17.999]' | head -n 1`
MSVC=`wslpath "$MSVC" | tr -d '\r'`
MSBUILD=$MSVC/MSBuild/Current/Bin/MSBuild.exe
for i in capture csvexport import-chrome update; do
echo $i...
"$MSBUILD" ../$i/build/win32/$i.sln /t:Clean /p:Configuration=Release /p:Platform=x64 /noconsolelogger /nologo -m
"$MSBUILD" ../$i/build/win32/$i.sln /t:Build /p:Configuration=Release /p:Platform=x64 /noconsolelogger /nologo -m
cp ../$i/build/win32/x64/Release/$i.exe tracy-build/
done
echo profiler...
"$MSBUILD" ../profiler/build/win32/Tracy.sln /t:Clean /p:Configuration=Release /p:Platform=x64 /noconsolelogger /nologo -m
"$MSBUILD" ../profiler/build/win32/Tracy.sln /t:Build /p:Configuration=Release /p:Platform=x64 /noconsolelogger /nologo -m
cp ../profiler/build/win32/x64/Release/Tracy.exe tracy-build/

154
third_party/tracy/extra/natvis.py vendored Normal file
View File

@@ -0,0 +1,154 @@
import lldb
def VectorSummary(value, dict):
v = value.GetNonSyntheticValue()
size = v.GetChildMemberWithName('m_size').GetValueAsUnsigned()
capacityVal = v.GetChildMemberWithName('m_capacity').GetValueAsUnsigned()
capacity = 1 << capacityVal if capacityVal < 63 else 'read-only'
magic = bool(v.GetChildMemberWithName('m_magic').GetValueAsUnsigned())
return f'{{size={size}, capacity={capacity}, magic={magic}}}'
def ShortPtrSummary(value, dict):
val = value.GetNonSyntheticValue()
ptr = val.GetChildMemberWithName('m_ptr')
type = val.GetType().GetTemplateArgumentType(0)
p0 = ptr.GetChildAtIndex(0).GetValueAsUnsigned()
p1 = ptr.GetChildAtIndex(1).GetValueAsUnsigned()
p2 = ptr.GetChildAtIndex(2).GetValueAsUnsigned()
p3 = ptr.GetChildAtIndex(3).GetValueAsUnsigned()
p4 = ptr.GetChildAtIndex(4).GetValueAsUnsigned()
p5 = ptr.GetChildAtIndex(5).GetValueAsUnsigned()
#return '0x{0:02x}{1:02x}{2:02x}{3:02x}{4:02x}{5:02x}'.format(p5, p4, p3, p2, p1, p0)
return value.CreateValueFromAddress('m_ptr', p0 | (p1 << 8) | (p2 << 16) | (p3 << 24) | (p4 << 32) | (p5 << 40), type)
class ShortPtrPrinter:
def __init__(self, val, dict):
self.val = val
self.type = self.val.GetType().GetTemplateArgumentType(0)
def update(self):
ptr = self.val.GetChildMemberWithName('m_ptr')
p0 = ptr.GetChildAtIndex(0).GetValueAsUnsigned()
p1 = ptr.GetChildAtIndex(1).GetValueAsUnsigned()
p2 = ptr.GetChildAtIndex(2).GetValueAsUnsigned()
p3 = ptr.GetChildAtIndex(3).GetValueAsUnsigned()
p4 = ptr.GetChildAtIndex(4).GetValueAsUnsigned()
p5 = ptr.GetChildAtIndex(5).GetValueAsUnsigned()
self.ptr = p0 | (p1 << 8) | (p2 << 16) | (p3 << 24) | (p4 << 32) | (p5 << 40)
def num_children(self):
return 1
def get_child_index(self, name):
return int(name.lstrip('[').rstrip(']'))
def get_child_at_index(self, index):
return self.val.CreateValueFromAddress('m_ptr', self.ptr, self.type)
class VectorPrinter:
def __init__(self, val, dict):
self.val = val
self.magic = bool(val.GetChildMemberWithName('m_magic').GetValueAsUnsigned())
if self.magic:
self.type = val.GetType().GetTemplateArgumentType(0).GetTemplateArgumentType(0)
else:
self.type = val.GetType().GetTemplateArgumentType(0)
self.stride = self.type.GetByteSize()
def update(self):
ptr = self.val.GetChildMemberWithName('m_ptr').GetChildMemberWithName('m_ptr')
p0 = ptr.GetChildAtIndex(0).GetValueAsUnsigned()
p1 = ptr.GetChildAtIndex(1).GetValueAsUnsigned()
p2 = ptr.GetChildAtIndex(2).GetValueAsUnsigned()
p3 = ptr.GetChildAtIndex(3).GetValueAsUnsigned()
p4 = ptr.GetChildAtIndex(4).GetValueAsUnsigned()
p5 = ptr.GetChildAtIndex(5).GetValueAsUnsigned()
self.ptr = p0 | (p1 << 8) | (p2 << 16) | (p3 << 24) | (p4 << 32) | (p5 << 40)
self.size = self.val.GetChildMemberWithName('m_size').GetValueAsUnsigned()
def num_children(self):
return self.size
def get_child_index(self, name):
return int(name.lstrip('[').rstrip(']'))
def get_child_at_index(self, index):
return self.val.CreateValueFromAddress('[%d]' % index, self.ptr + index * self.stride, self.type)
def Int24Summary(value, dict):
val = value.GetNonSyntheticValue().GetChildMemberWithName('m_val')
p0 = val.GetChildAtIndex(0).GetValueAsUnsigned()
p1 = val.GetChildAtIndex(1).GetValueAsUnsigned()
p2 = val.GetChildAtIndex(2).GetValueAsUnsigned()
return p0 | (p1 << 8) | (p2 << 16)
def Int48Summary(value, dict):
val = value.GetNonSyntheticValue().GetChildMemberWithName('m_val')
p0 = val.GetChildAtIndex(0).GetValueAsUnsigned()
p1 = val.GetChildAtIndex(1).GetValueAsUnsigned()
p2 = val.GetChildAtIndex(2).GetValueAsUnsigned()
p3 = val.GetChildAtIndex(3).GetValueAsUnsigned()
p4 = val.GetChildAtIndex(4).GetValueAsUnsigned()
p5 = val.GetChildAtIndex(5).GetValueAsUnsigned()
return p0 | (p1 << 8) | (p2 << 16) | (p3 << 24) | (p4 << 32) | (p5 << 40)
class ZoneEventPrinter:
def __init__(self, val, dict):
self.val = val
def update(self):
_start_srcloc = self.val.GetChildMemberWithName('_start_srcloc').GetValueAsUnsigned()
_child2 = self.val.GetChildMemberWithName('_child2').GetValueAsUnsigned()
_end_child1 = self.val.GetChildMemberWithName('_end_child1').GetValueAsUnsigned()
self.extra = self.val.GetChildMemberWithName('extra').GetValueAsUnsigned()
self.start = _start_srcloc >> 16
self.end = _end_child1 >> 16
self.srcloc = _start_srcloc & 0xffff
self.child = ((_end_child1 & 0xffff) << 16) | _child2
def num_children(self):
return 5
def get_child_index(self, name):
if name == 'start':
return 0
if name == 'end':
return 1
if name == 'srcloc':
return 2
if name == 'child':
return 3
if name == 'extra':
return 4
return -1
def get_child_at_index(self, index):
if index == 0:
return self.val.CreateValueFromExpression('start', f'int64_t x = {self.start}; x')
if index == 1:
return self.val.CreateValueFromExpression('end', f'int64_t x = {self.end}; x')
if index == 2:
return self.val.CreateValueFromExpression('srcloc', f'int16_t x = {self.srcloc}; x')
if index == 3:
return self.val.CreateValueFromExpression('child', f'int32_t x = {self.child}; x')
if index == 4:
return self.val.CreateValueFromExpression('extra', f'uint32_t x = {self.extra}; x')
def RobinHoodSummary(value, dict):
val = value.GetNonSyntheticValue()
size = val.GetChildMemberWithName('mNumElements').GetValueAsUnsigned()
mask = val.GetChildMemberWithName('mMask').GetValueAsUnsigned()
return f'{{size={size}, load={float(size) / (mask+1)}}}'
def __lldb_init_module(debugger, dict):
lldb.formatters.Logger._lldb_formatters_debug_level = 2
debugger.HandleCommand('type summary add -w tracy -F natvis.VectorSummary -x ^tracy::Vector<.+>')
debugger.HandleCommand('type summary add -w tracy -F natvis.ShortPtrSummary -x ^tracy::short_ptr<.+>')
debugger.HandleCommand('type summary add -w tracy -F natvis.Int24Summary -x ^tracy::Int24')
debugger.HandleCommand('type summary add -w tracy -F natvis.Int48Summary -x ^tracy::Int48')
debugger.HandleCommand('type summary add -w tracy -F natvis.RobinHoodSummary -x ^tracy::detail::Table<.*>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.VectorPrinter -x ^tracy::Vector<.+>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.ShortPtrPrinter -x ^tracy::short_ptr<.+>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.ZoneEventPrinter -x ^tracy::ZoneEvent')
debugger.HandleCommand('type summary add -w tracy -x ^tracy::ZoneEvent --summary-string "start = ${var.start}, end = ${var.end}, srcloc = ${var.srcloc}, child = ${var.child}, extra = ${var.extra}"')
debugger.HandleCommand('type category enable tracy')

24
third_party/tracy/extra/rdotbl.c vendored Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
int main()
{
//int a = 16, b = 44, s = 4;
//int av = 12, bv = 6, cv = 3;
//int a = 32, b = 48, s = 16;
//int av = 12, bv = 6, cv = 3;
int a = 48, b = 64, s = 16;
int av = 48, bv = 32, cv = 24;
printf( "int TrTbl[] = { " );
int first = 1;
for( int i=0; i<256; i+=s )
{
if( first ) first = 0; else printf( ", " );
if( i < a ) printf( "%i", av );
else if( i < b ) printf( "%i", bv );
else printf( "%i", cv );
}
printf( " };\n" );
}

View File

@@ -0,0 +1,46 @@
#include <stdint.h>
namespace tracy
{
struct AsmDesc
{
uint8_t type;
uint16_t width;
};
struct AsmVar
{
int descNum;
AsmDesc desc[5];
int isaSet;
float tp;
int port, uops, minlat, maxlat;
bool minbound, maxbound;
};
struct AsmOp
{
int id;
int descId;
int numVariants;
const AsmVar*const* variant;
};
struct MicroArchitecture
{
int numOps;
const AsmOp*const* ops;
};
extern const char* MicroArchitectureList[];
extern const char* PortList[];
extern const char* OpsList[];
extern const char* OpDescList[];
extern const char* IsaList[];
extern const MicroArchitecture* const MicroArchitectureData[];
extern int OpsNum;
extern int MicroArchitectureNum;
};

326
third_party/tracy/extra/uarch/uarch.cpp vendored Normal file
View File

@@ -0,0 +1,326 @@
// Use with instructions.xml retrieved from uops.info
#include <algorithm>
#include <assert.h>
#include <limits>
#include <stdio.h>
#include <string>
#include <string.h>
#include <pugixml.hpp>
#include <unordered_map>
#include <vector>
struct Dictionary
{
int Get( const std::string& str )
{
auto it = str2idx.find( str );
if( it != str2idx.end() ) return it->second;
const auto idx = strlist.size();
str2idx.emplace( str, idx );
strlist.emplace_back( str );
return idx;
}
int Get( const char* str ) { return Get( std::string( str ) ); }
const std::string& Get( int idx ) const
{
return strlist[idx];
}
size_t Size() const { return strlist.size(); }
std::unordered_map<std::string, int> str2idx;
std::vector<std::string> strlist;
};
struct ParamDesc
{
int type;
int width;
};
struct Variant
{
std::vector<ParamDesc> desc;
int isaSet;
float tp;
int port, uops, minlat, maxlat;
bool minbound, maxbound;
};
struct Op
{
std::vector<Variant> var;
int desc;
};
struct UArch
{
std::unordered_map<int, Op> ops;
};
const std::vector<std::pair<const char*, const char*>> LatencyValues = {
{ "cycles", "cycles_is_upper_bound" },
{ "cycles_addr", "cycles_addr_is_upper_bound" },
{ "cycles_addr_same_reg", "cycles_addr_same_reg_is_upper_bound" },
{ "cycles_addr_VSIB", "cycles_addr_VSIB_is_upper_bound" },
{ "cycles_mem", "cycles_mem_is_upper_bound" },
{ "cycles_mem_same_reg", "cycles_mem_same_reg_is_upper_bound" },
{ "cycles_same_reg", "cycles_same_reg_is_upper_bound" },
{ "max_cycles", "max_cycles_is_upper_bound" },
{ "max_cycles_addr", "max_cycles_addr_is_upper_bound" },
{ "min_cycles", "min_cycles_is_upper_bound" },
{ "min_cycles_addr", "min_cycles_addr_is_upper_bound" },
};
int main()
{
pugi::xml_document doc;
doc.load_file( "instructions.xml" );
auto root = doc.child( "root" );
Dictionary ops;
Dictionary opsdesc;
Dictionary uarchs;
Dictionary ports;
Dictionary isas;
std::vector<UArch> uav;
for( auto& ext : root )
{
assert( strcmp( ext.name(), "extension" ) == 0 );
for( auto& op : ext )
{
assert( strcmp( op.name(), "instruction" ) == 0 );
auto opstr = op.attribute( "asm" ).value();
auto opdesc = op.attribute( "summary" ).value();
bool magic = false;
if( opstr[0] == '{' )
{
if( memcmp( opstr, "{load} ", 7 ) == 0 )
{
magic = true;
opstr += 7;
}
else
{
continue;
}
}
char tmpbuf[64];
auto opstr2 = op.attribute( "string" ).value();
const auto strnext = opstr2[strlen(opstr)];
if( !magic && strnext != ' ' && strnext != '\0' )
{
if( memcmp( opstr2, "LEA_", 4 ) == 0 )
{
auto ptr = tmpbuf;
opstr = tmpbuf;
while( *opstr2 != ' ' ) *ptr++ = *opstr2++;
*ptr = '\0';
}
else
{
continue;
}
}
const auto opidx = ops.Get( opstr );
const auto opdescidx = opsdesc.Get( opdesc );
int isaSet = isas.Get( op.attribute( "isa-set" ).value() );
std::vector<ParamDesc> desc;
for( auto& param : op.children( "operand" ) )
{
if( !param.attribute( "suppressed" ) )
{
int type = 0;
if( strcmp( param.attribute( "type" ).value(), "imm" ) == 0 ) type = 0;
else if( strcmp( param.attribute( "type" ).value(), "reg" ) == 0 ) type = 1;
else if( strcmp( param.attribute( "type" ).value(), "mem" ) == 0 ) type = 2;
else if( strcmp( param.attribute( "type" ).value(), "agen" ) == 0 ) type = 2;
desc.emplace_back( ParamDesc { type, atoi( param.attribute( "width" ).value() ) } );
}
}
for( auto& ua : op.children( "architecture" ) )
{
auto measurement = ua.child( "measurement" );
if( measurement )
{
const auto uaidx = uarchs.Get( ua.attribute( "name" ).value() );
if( uav.size() <= uaidx ) uav.emplace_back( UArch {} );
auto& uai = uav[uaidx];
auto& opi = uai.ops[opidx];
opi.desc = opdescidx;
float tp = -1;
if( measurement.attribute( "TP" ) ) tp = atof( measurement.attribute( "TP" ).value() );
else if( measurement.attribute( "TP_ports" ) ) tp = atof( measurement.attribute( "TP_ports" ).value() );
else if( measurement.attribute( "TP_unrolled" ) ) tp = atof( measurement.attribute( "TP_unrolled" ).value() );
int portid = measurement.attribute( "ports" ) ? ports.Get( measurement.attribute( "ports" ).value() ) : -1;
int uops = measurement.attribute( "uops" ) ? atoi( measurement.attribute( "uops" ).value() ) : -1;
assert( tp != -1 && uops != -1 );
int minlat = std::numeric_limits<int>::max();
int maxlat = -1;
bool minbound = false;
bool maxbound = false;
for( auto& lat : measurement.children( "latency" ) )
{
for( auto& v : LatencyValues )
{
auto attr = lat.attribute( v.first );
if( attr )
{
const auto av = atoi( attr.value() );
bool bound = lat.attribute( v.second );
if( minlat > av || ( minlat == av && minbound ) )
{
minlat = av;
minbound = bound;
}
if( maxlat < av || ( maxlat == av && maxbound ) )
{
maxlat = av;
maxbound = bound;
}
}
}
}
if( maxlat == -1 ) minlat = -1;
opi.var.emplace_back( Variant { desc, isaSet, tp, portid, uops, minlat, maxlat, minbound, maxbound } );
}
}
}
}
printf( "#include \"TracyMicroArchitecture.hpp\"\n\n" );
printf( "namespace tracy\n{\n\n" );
printf( "const char* MicroArchitectureList[]={\n" );
for( auto& v : uarchs.strlist )
{
printf( "\"%s\",\n", v.c_str() );
}
printf( "};\n\n" );
printf( "const char* PortList[]={\n" );
for( auto& v : ports.strlist )
{
printf( "\"%s\",\n", v.c_str() );
}
printf( "};\n\n" );
printf( "const char* OpsList[]={\n" );
for( auto& v : ops.strlist )
{
printf( "\"%s\",\n", v.c_str() );
}
printf( "};\n\n" );
printf( "const char* IsaList[]={\n" );
for( auto& v : isas.strlist )
{
printf( "\"%s\",\n", v.c_str() );
}
printf( "};\n\n" );
printf( "const char* OpDescList[]={\n" );
for( auto& v : opsdesc.strlist )
{
printf( "\"%s\",\n", v.c_str() );
}
printf( "};\n\n" );
printf( "#define V static constexpr AsmVar\n" );
printf( "#define A static constexpr AsmVar const*\n\n" );
int uaidx = 0;
for( auto& ua : uav )
{
for( auto& op: ua.ops )
{
int varidx = 0;
for( auto& var: op.second.var )
{
printf( "V z%x_%x_%x={%i,{", uaidx, op.first, varidx++, (int)var.desc.size() );
bool first = true;
for( auto& p : var.desc )
{
if( first ) first = false;
else printf( "," );
printf( "{%i,%i}", p.type, p.width );
}
printf( "},%i,%.2ff,%i,%i,%i,%i,%c,%c};\n", var.isaSet, var.tp, var.port, var.uops, var.minlat, var.maxlat, var.minbound ? '1' : '0', var.maxbound ? '1' : '0' );
}
varidx = 0;
printf( "A y%x_%x[]={", uaidx, op.first );
bool first = true;
for( auto& var: op.second.var )
{
if( first ) first = false;
else printf( "," );
printf( "&z%x_%x_%x", uaidx, op.first, varidx++ );
}
printf( "};\n" );
}
uaidx++;
}
printf( "\n\n#define O static constexpr AsmOp\n\n" );
uaidx = 0;
for( auto& ua : uav )
{
std::vector<decltype(ua.ops.begin())> opsort;
for( auto it = ua.ops.begin(); it != ua.ops.end(); ++it )
{
auto& op = *it;
printf( "O x%x_%x={%i,%i,%i,y%x_%x};\n", uaidx, op.first, op.first, op.second.desc, (int)op.second.var.size(), uaidx, op.first );
opsort.emplace_back( it );
}
std::sort( opsort.begin(), opsort.end(), []( const auto& l, const auto& r ) { return l->first < r->first; } );
printf( "static constexpr AsmOp const* w%x[]={", uaidx );
bool first = true;
for( auto& op: opsort )
{
if( first ) first = false;
else printf( "," );
printf( "&x%x_%x", uaidx, op->first );
}
printf( "};\n" );
uaidx++;
}
printf( "\n" );
uaidx = 0;
for( auto& ua : uav )
{
printf( "static constexpr MicroArchitecture v%x={%i,w%x};\n", uaidx, (int)ua.ops.size(), uaidx );
uaidx++;
}
printf( "\nconst MicroArchitecture* const MicroArchitectureData[]={" );
uaidx = 0;
bool first = true;
for( auto& ua : uav )
{
if( first ) first = false;
else printf( "," );
printf( "&v%x", uaidx++ );
}
printf( "};\n\n" );
printf( "int OpsNum=%i;\nint MicroArchitectureNum=%i;\n", (int)ops.Size(), (int)uarchs.Size() );
printf( "}\n" );
}

View File

@@ -0,0 +1,13 @@
#!/bin/sh
version_header="../public/common/TracyVersion.hpp"
major=$(grep -o -E 'Major = [0-9]+' "$version_header" | awk -F '= ' '{print $2}')
minor=$(grep -o -E 'Minor = [0-9]+' "$version_header" | awk -F '= ' '{print $2}')
patch=$(grep -o -E 'Patch = [0-9]+' "$version_header" | awk -F '= ' '{print $2}')
version="${major}.${minor}.${patch}"
# the extension is required for macOS's outdated sed
sed -i.bak "s/version: '[0-9]*\.[0-9]*\.[0-9]*'/version: '$version'/g" ../meson.build
rm ../meson.build.bak

11
third_party/tracy/extra/version.cpp vendored Normal file
View File

@@ -0,0 +1,11 @@
#include <stdint.h>
#include <stdio.h>
#include "../server/TracyFileHeader.hpp"
#include "../public/common/TracyVersion.hpp"
int main()
{
const auto ver = uint32_t( tracy::FileVersion( tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch ) );
fwrite( &ver, 1, 4, stdout );
}

42
third_party/tracy/extra/x11_colors.c vendored Normal file
View File

@@ -0,0 +1,42 @@
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE* f = fopen( "rgb.txt", "rb" );
char buf[1024];
int off = 0;
for(;;)
{
int sz = fread( buf+off, 1, 1, f );
if( buf[off] == '\r' || buf[off] == '\n' || sz == 0 )
{
if( off == 0 )
{
if( sz == 0 ) break;
continue;
}
int ok = 1;
for( int i=13; i<off; i++ )
{
if( buf[i] == ' ' ) ok = 0;
}
if( ok == 1 )
{
buf[off] = '\0';
int r, g, b;
sscanf( buf, "%i %i %i", &r, &g, &b );
printf( "%s = 0x%02x%02x%02x,\n", buf+13, r, g, b );
}
off = 0;
}
else
{
off++;
}
if( sz == 0 ) break;
}
fclose( f );
}

67
third_party/tracy/extra/zigzag.svg vendored Normal file
View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="32"
height="32"
viewBox="0 0 8.4666665 8.4666666"
version="1.1"
id="svg5"
inkscape:export-filename="zigzag.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
sodipodi:docname="zigzag.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="px"
showgrid="true"
showguides="true"
inkscape:zoom="26.808186"
inkscape:cx="14.603748"
inkscape:cy="18.893483"
inkscape:window-width="3840"
inkscape:window-height="2054"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
type="xygrid"
id="grid132"
originx="0"
originy="0" />
<sodipodi:guide
position="3.7041666,4.2333333"
orientation="0,-1"
id="guide742"
inkscape:locked="false" />
<sodipodi:guide
position="4.2333333,4.2333333"
orientation="1,0"
id="guide744"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Warstwa 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#ffffff;stroke-width:0.79374999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none;paint-order:normal;stroke-dashoffset:0"
d="M -0.79374999,5.0270833 2.1166666,2.1166666 6.3499999,6.3499999 9.2604166,3.4395833"
id="path800" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
third_party/tracy/extra/zigzag01.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

BIN
third_party/tracy/extra/zigzag02.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

BIN
third_party/tracy/extra/zigzag04.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

BIN
third_party/tracy/extra/zigzag08.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

BIN
third_party/tracy/extra/zigzag16.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

BIN
third_party/tracy/extra/zigzag32.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B