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

[WIP] polyhedral compiler passing all tests #8

Merged
merged 58 commits into from
Aug 12, 2024
Merged

Conversation

hikettei
Copy link
Owner

@hikettei hikettei commented Aug 9, 2024

  • Implement Backward
  • %where compilation fails
  • Fix tan (needs to implement in-place mutation)
  • Integrate all Expr renderers into %render-expr
  • Affine Scheduling

ばぐ〜〜

  • tmpvar 宣言して使わない
  • Recursively Groupingの範囲 vs VMで計算する範囲?
  • reductionのraw dependencies?

@hikettei
Copy link
Owner Author

hikettei commented Aug 11, 2024

Softmax fused in a single kernel:
(schedule_count needs to be included in the test)

TEST> (caten (!softmax (make-tensor `(3 3) :initial-element 1.0)))
Compiled:

#include <math.h>
#include <stdint.h>
#define boolean _Bool
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
/*
Arrays:
  - val_6[float32]: (3 1)
  - val_0[float32]: (3 3)
*/
void main1599824(float* val_6, float* val_0);
void main1599824(float* val_6, float* val_0) {
  float val_2;
  for(int c0=0;(c0<=2);c0+=1) {
    val_6[(c0)+(0)] = 0.0;
    for(int c1=0;(c1<=2);c1+=1) {
      val_2 = 1.442695;
      val_0[3*(c0)+(c1)] = 1.0;
      val_0[3*(c0)+(c1)] = val_0[3*(c0)+(c1)]*val_2;
      val_0[3*(c0)+(c1)] = exp2(val_0[3*(c0)+(c1)]);
      val_6[(c0)+0] += val_0[3*(c0)+(c1)];
    }
    val_6[(c0)+0] = 1.0 / (val_6[(c0)+0]);
    for(int c1=2;(c1<=4);c1+=1) {
      val_0[3*(c0)+((c1-2))] = val_0[3*(c0)+((c1-2))]*val_6[(c0)+0];
    }
  }
}

@hikettei
Copy link
Owner Author

TODO整理してMultiExpr直したらMergeする

@hikettei hikettei merged commit 34ac884 into main Aug 12, 2024
1 of 3 checks passed
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.

1 participant