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

[Bug] cuda code compilation error #89

Closed
soodoshll opened this issue Feb 12, 2023 · 0 comments · Fixed by #101
Closed

[Bug] cuda code compilation error #89

soodoshll opened this issue Feb 12, 2023 · 0 comments · Fixed by #101

Comments

@soodoshll
Copy link
Collaborator

I have the following cuda code generated by hidet:

#include <cuda_fp16.h>
#include <cuda_bf16.h>
#include <hidet/runtime/cuda_context.h>
#include <hidet/runtime/cpu_context.h>
typedef float tfloat32_t;
#define __float_to_tf32(x) (x)
/*
Task(
  name: clip
  parameters:
    x: tensor(int64, [1, 4, 1, 1])
    y: tensor(int64, [1, 4, 1, 1])
  inputs: [x]
  outputs: [y]
  computations:
    x: tensor(int64, [1, 4, 1, 1])
    y: int64[1, 4, 1, 1] where y[v, v_1, v_2, v_3] = generic_min(generic_max(x[v, v_1, v_2, v_3], int64(-1)), int64(1))
  attributes: {}
)
*/
extern "C" {

__global__ void __launch_bounds__(500) hidet_compute_y(int64_t * __restrict__ x, int64_t * __restrict__ y) {
  if ((int)threadIdx.x < 4) {
    y[((int)threadIdx.x % 4)] = min(max(x[((int)threadIdx.x % 4)], -1ll), 1ll);
  }
}

__host__ void hidet_clip(int32_t num_args, int32_t * __restrict__ arg_types, void* * __restrict__ args) {
  hidet_compute_y<<<1, 500, 0, (cudaStream_t)get_cuda_stream()>>>(((int64_t*)(args[0])), ((int64_t*)(args[1])));
}

}

And nvcc raises an error:

 error: more than one instance of overloaded function "max" matches the argument list:
            function "max(long, long)"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(1008): here
            function "max(long, unsigned long)"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(1043): here
            function "max(long long, long long)"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(1077): here
            function "max(unsigned long long, long long)"
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.hpp(1092): here
            argument types are: (int64_t, long long)
yaoyaoding pushed a commit that referenced this issue Apr 3, 2024
Flagging slow tests as a result of huggingface dependency
(2hrs). To debug on private CI runs.

Resolves #87.
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 a pull request may close this issue.

1 participant