Skip to content

Commit

Permalink
chore: update API ignorelist
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Sep 3, 2024
1 parent 5e6fc6b commit dc08a6b
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions tools/api-coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ const SYMBOL_USAGE_REGEX = /ortsys!\[\s*(?:unsafe\s+)?([A-Za-z_][A-Za-z0-9_]+)/g

const IGNORED_SYMBOLS = new Set<string>([
'CreateEnv', // we will always create an env with a custom logger for integration w/ tracing
'CreateEnvWithGlobalThreadPools',
'KernelContext_GetScratchBuffer', // implemented in src/operator/kernel.rs but impl appears to be broken so ignoring
'RegisterCustomOpsLibrary', // we use RegisterCustomOpsLibrary_V2
'RegisterCustomOpsUsingFunction',
'SessionOptionsAppendExecutionProvider_CUDA', // we use V2
'SessionOptionsAppendExecutionProvider_TensorRT', // we use V2
'SetLanguageProjection', // someday we shall have `ORT_PROJECTION_RUST`, but alas, today is not that day...

// we use allocator APIs directly on the Allocator struct
'AllocatorAlloc',
'AllocatorFree',
'AllocatorGetInfo',

// functions that don't make sense with SessionBuilder API
'HasSessionConfigEntry',
'GetSessionConfigEntry',
'DisableProfiling',
'GetCUDAProviderOptionsAsString',
'GetTensorRTProviderOptionsAsString',
'GetCANNProviderOptionsAsString',
'GetDnnlProviderOptionsAsString'
]);

const sysSymbols = new Set<string>();
Expand Down Expand Up @@ -45,10 +66,9 @@ for await (const sourceFile of walk(join(PROJECT_ROOT, 'src'))) {
}
}

const unusedSymbols = sysSymbols
.difference(usedSymbols)
.difference(IGNORED_SYMBOLS);
const nonIgnoredSymbols = sysSymbols.difference(IGNORED_SYMBOLS);
const unusedSymbols = nonIgnoredSymbols.difference(usedSymbols);
for (const symbol of unusedSymbols) {
console.log(`%c\t${symbol}`, 'color: red');
}
console.log(`%cCoverage: ${usedSymbols.size}/${sysSymbols.size} (${((usedSymbols.size / sysSymbols.size) * 100).toFixed(2)}%)`, 'color: green; font-weight: bold');
console.log(`%cCoverage: ${usedSymbols.size}/${nonIgnoredSymbols.size} (${((usedSymbols.size / nonIgnoredSymbols.size) * 100).toFixed(2)}%)`, 'color: green; font-weight: bold');

0 comments on commit dc08a6b

Please sign in to comment.