Skip to content

auto schedule for GPU #2852

@vmiheer

Description

@vmiheer

I was wondering can I do auto scheduling for GPUs?
I have simple halide code:

  for (int y = 0; y < size; y++) {
    for (int x = 0; x < size; x++) {
      A(x, y) = rand() & 0xfff;
    }
  }
  Var j("j"), i("i"), k("k");
  Func out4("out4");
  out4(i, j) = A(i, j) * 2;

  Target target = get_target_from_environment();
  target.set_feature(Halide::Target::CUDACapability35);
  target.set_feature(Halide::Target::CUDA);

  Pipeline p(out4);
  out4.estimate(i, 0, size).estimate(j, 0, size);
  cout << p.auto_schedule(target);

I get schedule:

// Target: x86-64-linux-avx-avx2-cuda-cuda_capability_35-f16c-fma-sse41
// MachineParams: 16,16777216,40
Var i_vi("i_vi");
Var i_vo("i_vo");
Func out4 = pipeline.get_func(0);
{
    Var i = out4.args()[0];
    Var j = out4.args()[1];
    out4
        .compute_root()
        .split(i, i_vo, i_vi, 8)
        .vectorize(i_vi)
        .parallel(j);
}

Now even though the Target has feature: cuda, the code is not running on GPU.
Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    autoschedulerRelated to one or more of the AutoschedulersbuildIssues related to building Halide and with CI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions