<commit_before>#include "FImage.h"

using namespace FImage;

int main(int argc, char **argv) {
  Var x, y;
    Func f, g;

    printf("Defining function...\n");

    f(x, y) = 2.0;
    g(x, y) = f(x+1, y) + f(x-1, y);

    Var xo, xi, yo, yi;

    g.split(x, xo, xi, 4);
    g.split(y, yo, yi, 4);
    g.transpose(xo, yi);
    f.chunk(xo);

    printf("Realizing function...\n");

    assert(f.returnType() == Float(64));
    assert(g.returnType() == Float(64));

    Image<double> im = g.realize(32, 32);

    for (size_t i = 0; i < 32; i++) {
        if (im(i) != 4.0) {
            for (size_t j = 0; j < 32; j++) {
                printf("im[%d] = %f\n", j, im(j));
            }
            return -1;
        }
    }

    printf("Success!\n");
    return 0;
}
<commit_msg>Chunk test works on PTX<commit_after>#include "FImage.h"

using namespace FImage;

int main(int argc, char **argv) {
    Var x("x"), y("y");
    Var xo("blockidx"), xi("threadidx"), yo("blockidy"), yi("threadidy");
    
    Func f("f"), g("g");

    printf("Defining function...\n");

    // This is kind of ugly -- trying to force g.f to be over threadid{x,y} when chunked
    // Also: CUDA on older machines is unhappy with doubles, so now use floats
    f(xi, yi) = 2.0f;
    g(x, y) = f(x+1, y) + f(x-1, y);

    g.split(x, xo, xi, 8);
    g.split(y, yo, yi, 8);
    g.transpose(xo, yi);
    f.chunk(xo);
    
    if (use_gpu()) {
        g.parallel(xo).parallel(xi).parallel(yo).parallel(yi);
        f.parallel(xi).parallel(yi);
    }

    printf("Realizing function...\n");

    Image<float> im = g.realize(32, 32);

    for (size_t i = 0; i < 32; i++) {
        for (size_t j = 0; j < 32; j++) {
            if (im(i,j) != 4.0) {
                printf("im[%d, %d] = %f\n", (int)i, (int)j, im(i,j));
                return -1;
            }
        }
    }

    printf("Success!\n");
    return 0;
}

{'fraction_non_alphanumeric': 0.2073170731707317, 'fraction_numerical': 0.02332979851537646, 'mean_word_length': 2.0095693779904304, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5182018', 'n_tokens_mistral': 817, 'n_tokens_neox': 756, 'n_words': 192}