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

Polly can't delinearize some affine access due to type casting #23800

Closed
llvmbot opened this issue May 6, 2015 · 2 comments
Closed

Polly can't delinearize some affine access due to type casting #23800

llvmbot opened this issue May 6, 2015 · 2 comments
Labels
bugzilla Issues migrated from bugzilla polly

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented May 6, 2015

Bugzilla Link 23426
Resolution FIXED
Resolved on Jan 18, 2016 17:00
Version unspecified
OS Linux
Attachments matmul kernel Polly failed to detect SCOPs from, C source file of the matmul kernel, Makefile to generate IR files and run the analysis
Reporter LLVM Bugzilla Contributor
CC @tobiasgrosser

Extended Description

In the testcase attached a matmul kernel was given. The matrix dimension sizes are given in 32bit 'int' type.

When running SCOP detection on this kernel on a 64bit machine, Polly failed to detect the SCOP as expected because delinearization failed. In the first step of delinearization, Polly tries to collect parametric terms from all affine accesses and it expect every access is represented by a SCEVAddRecExpr. However, type casting (sign extending i32 to i64) may cause the access function to matrix C to be another kind of SCEV instead of SCEVAddRecExpr. For instance, running analysis on the given testcase, an SCEVMulExpr access function appears as '(8 * (sext i32 {{%ldc,+,%ldc}<%for.cond1.preheader>,+,1}<%for.body3> to i64))'.

To fix this, Hoisting all sext to the leaves (SCEVUnknowns) of the SCEV
expression may indeed be a good strategy (basically using a uniform
maximal type for the expression) may indeed be a good strategy. Some 'canonicalization' may be done to each access function before delinearization, turning '(8 * (sext i32 {{0,+,%ldc}<%for.cond1.preheader>,+,1}<%for.body3> to i64))' to an equal SCEVAddRecExpr '{{0,+, (8 *(sext i32 %ldc to i64)))}<%for.cond1.preheader>,+,8}<%for.body3>'.

@tobiasgrosser
Copy link
Contributor

This was fixed in r238643 by adding the indvar pass to the canonicalization sequence.

@tlattner
Copy link
Contributor

Move to Polly Product.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla polly
Projects
None yet
Development

No branches or pull requests

3 participants