Skip to content

[CUDA] [Codegen] Ensuring atleast one thread block to handle empty tensor#7273

Merged
masahi merged 1 commit into
apache:mainfrom
anijain2305:cuda_illegal
Jan 14, 2021
Merged

[CUDA] [Codegen] Ensuring atleast one thread block to handle empty tensor#7273
masahi merged 1 commit into
apache:mainfrom
anijain2305:cuda_illegal

Conversation

@anijain2305

Copy link
Copy Markdown
Contributor

Topk was failing on CUDA when k is a var and its value is 0 at runtime. At closer inspection I found that there are 0 thread blocks at runtime. This PR ensures that there is atleast 1 thread block.

@anijain2305

Copy link
Copy Markdown
Contributor Author

@kevinthesun @masahi @mbrookhart @zhiics @trevor-m Please review.

@anijain2305 anijain2305 changed the title [CUDA] [Codegen] Ensuring atleast one thread block for dynamism [CUDA] [Codegen] Ensuring atleast one thread block to handle empty tensor Jan 13, 2021
@masahi

masahi commented Jan 13, 2021

Copy link
Copy Markdown
Member

hmm, I think I've already added a fix for such cases, here:

if attr_key == "thread_extent":
value = op.max(1, value)

Do you know why it is not working? cc @mbrookhart

@anijain2305

anijain2305 commented Jan 13, 2021

Copy link
Copy Markdown
Contributor Author

hmm, I think I've already added a fix for such cases, here:

if attr_key == "thread_extent":
value = op.max(1, value)

Do you know why it is not working? cc @mbrookhart

Is this because this the lines that you suggested are specific to IR Builder, while the failure that I see is for injective schedule? My failures was coming for an injective schedule.

@mbrookhart

Copy link
Copy Markdown
Contributor

Yeah, I think this change catches it at a lower level. We might not need the ir_builder change after this.

@kevinthesun kevinthesun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mbrookhart mbrookhart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@masahi masahi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants