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

webgl: Fix the incorrect result with shapes uniforms #5502

Merged
merged 4 commits into from Aug 23, 2021

Conversation

qjia7
Copy link
Collaborator

@qjia7 qjia7 commented Aug 17, 2021

BUG #5479

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@google-cla google-cla bot added the cla: yes label Aug 17, 2021
@qjia7
Copy link
Collaborator Author

qjia7 commented Aug 17, 2021

@mattsoulanille @pyu10055 @lina128 Please take a look, thanks.

@mattsoulanille please help to trigger the Nightly run to see if all cases can pass. I tested it on windows. All cases can pass with this PR.

isLogicalShapTexShapeEqual}_${rank1}_${rank2}_${rank34}_${
isTexShapeGreaterThanOne}_${hasOffset}`;
keyInputs += `${xRank}_${isInOutTexShapeEqual}_${
useSqueezeShape ? keptDims : ''}_${uniformShape.length}_${isScalar}_${
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some failures are caused by missing keptDims in shader key.
Previously, we couldn't distinguish

float getA(int row, int col, int depth)
{
  return getA(col, depth);
}

vs

float getA(int row, int col, int depth)
{
  return getA(row, depth);
}

const isScalar = util.sizeFromShape(x.shape) === 1;
const broadcastDims =
backend_util.getBroadcastDims(x.shape, output.shape);
const isInOutTexShapeEqual = !program.packedInputs &&
xRank === output.shape.length &&
util.arraysEqual(xTexShape, output.texData.texShape);
const isTexShapeGreaterThanOne = program.packedInputs || xRank > 2 ?
const isTexShapeGreaterThanOne =
program.packedInputs || uniformShape.length > 2 ?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some failures are caused by using xRank instead of uniformShape.length.
Previously, if we have a 3d shape, which maybe squeeze to a 2d shape, we should check whether the 2d shape's texShape is greater than one to be as the part of shaderKey. However, if we use xRank > 2 as the condition, isTexShapeGreaterThanOne will be an empty string which is not we expected.

@mattsoulanille
Copy link
Member

mattsoulanille commented Aug 17, 2021

Thank you! Here's the nightly run (still running at the time of writing).

@qjia7
Copy link
Collaborator Author

qjia7 commented Aug 18, 2021

Thank you! Here's the nightly run (still running at the time of writing).

It timed out. Could you please try it again?

@lina128
Copy link
Collaborator

lina128 commented Aug 18, 2021

Thank you! Here's the nightly run (still running at the time of writing).

It timed out. Could you please try it again?

Started retry.

@mattsoulanille
Copy link
Member

This is timing out due to another bug with Firefox on MacOS likely introduced by a PR between last Friday and Tuesday (but haven't narrowed it down yet). @pyu10055 is looking into it. I've manually tested this PR on Chrome Mac (browserstack), so I think the uniforms bug is fixed. However, It's probably best if we fix the nightly timeout and then get a successful nightly run on this branch before merging it.

Thanks again for the fix! I'll post another nightly run here once the timeout bug is fixed / reverted.

@qjia7
Copy link
Collaborator Author

qjia7 commented Aug 23, 2021

It seems that Ping has fixed the nightly test. Please take another look, thanks.

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New nightly run, which is passing! I also took a look at the changes, and they look good to me. Thank you! I would have taken a look at this earlier, but I was OOO Thursday and Friday.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @lina128 and @pyu10055)

@mattsoulanille
Copy link
Member

Fixes #5479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants