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

[error] [opengl] Better error message when int64 or sparse SNode not supported for OpenGL #1783

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions taichi/backends/metal/struct_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,11 @@ class StructCompiler {
emit(" SNodeRep_{} rep_;", snty_name);
emit("}};");
} else {
TI_ERROR("SNodeType={} not supported on Metal", snode_type_name(snty));
TI_NOT_IMPLEMENTED;
TI_ERROR(
"SNodeType={} not supported on OpenGL\n"
archibate marked this conversation as resolved.
Show resolved Hide resolved
"Consider use ti.init(ti.cpu) or ti.init(ti.cuda) if you "
archibate marked this conversation as resolved.
Show resolved Hide resolved
"want to use sparse data structures",
archibate marked this conversation as resolved.
Show resolved Hide resolved
snode_type_name(snode.type));
}
emit("");
}
Expand Down
9 changes: 8 additions & 1 deletion taichi/backends/opengl/codegen_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ class KernelGen : public IRVisitor {
// Note that the following two functions not only returns the corresponding
// data type, but also **records** the usage of `i64` and `f64`.
std::string opengl_data_type_short_name(DataType dt) {
if (dt == DataType::i64)
if (dt == DataType::i64) {
if (!TI_OPENGL_REQUIRE(used, GL_ARB_gpu_shader_int64)) {
TI_ERROR(
"Extension GL_ARB_gpu_shader_int64 not supported on your OpenGL");
}
used.int64 = true;
}
if (dt == DataType::f64)
used.float64 = true;
return data_type_short_name(dt);
Expand Down Expand Up @@ -811,6 +816,7 @@ class KernelGen : public IRVisitor {

void generate_struct_for_kernel(OffloadedStmt *stmt) {
TI_ASSERT(stmt->task_type == OffloadedStmt::TaskType::struct_for);
used.listman = true;
const std::string glsl_kernel_name = make_kernel_name();
emit("void {}()", glsl_kernel_name);
this->glsl_kernel_name_ = glsl_kernel_name;
Expand All @@ -829,6 +835,7 @@ class KernelGen : public IRVisitor {

void generate_clear_list_kernel(OffloadedStmt *stmt) {
TI_ASSERT(stmt->task_type == OffloadedStmt::TaskType::clear_list);
used.listman = true;
const std::string glsl_kernel_name = make_kernel_name();
emit("void {}()", glsl_kernel_name);
this->glsl_kernel_name_ = glsl_kernel_name;
Expand Down
7 changes: 5 additions & 2 deletions taichi/backends/opengl/struct_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ void OpenglStructCompiler::generate_types(const SNode &snode) {
snode_info.stride = snode_child_info.stride * n + extension; // my stride
snode_info.elem_stride = snode_child_info.stride; // my child stride
} else {
TI_ERROR("SNodeType={} not supported on OpenGL",
snode_type_name(snode.type));
TI_ERROR(
"SNodeType={} not supported on OpenGL\n"
"Consider use ti.init(ti.cpu) or ti.init(ti.cuda) if you "
archibate marked this conversation as resolved.
Show resolved Hide resolved
"want to use sparse data structures",
snode_type_name(snode.type));
TI_NOT_IMPLEMENTED;
}
}
Expand Down