Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture Utils, log bad weights only if debugging #4073

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,16 @@ export function graphWeights(height: number, weights: number[]) {
/**
* Validates the weights go from 0 to 1 in increasing order.
*/
function validateWeights(stage: string, weights: number[]) {
const showWeights = () => `
function validateWeights(t: GPUTest, stage: string, weights: number[]) {
const showWeights = t.rec.debugging
? () => `
${weights.map((v, i) => `${i.toString().padStart(2)}: ${v}`).join('\n')}

e = expected
A = actual
${graphWeights(32, weights)}
`;
`
: () => ``;

// Validate the weights
assert(
Expand Down Expand Up @@ -586,8 +588,8 @@ export async function queryMipLevelMixWeightsForDevice(t: GPUTest, stage: Shader

const [sampleLevelWeights, gradWeights] = unzip(result, kNumWeightTypes, 4);

validateWeights(stage, sampleLevelWeights);
validateWeights(stage, gradWeights);
validateWeights(t, stage, sampleLevelWeights);
validateWeights(t, stage, gradWeights);

texture.destroy();
storageBuffer.destroy();
Expand Down
Loading