text stringlengths 24 1.04M | metadata stringlengths 233 497 |
|---|---|
### File: taichi/gui/gui.h
#pragma once
#include "taichi/math/math.h"
#include "taichi/system/timer.h"
#include "taichi/program/kernel_profiler.h"
#include <atomic>
#include <ctime>
#include <numeric>
#include <unordered_map>
#if defined(TI_PLATFORM_LINUX)
#define TI_GUI_X11
#endif
#if defined(TI_PLATFORM_WINDOWS)
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/gui/gui.h", "license": "mit", "size": 24365} |
### File: taichi/gui/win32.cpp
#include "taichi/common/core.h"
#if defined(TI_PLATFORM_WINDOWS)
#include <windowsx.h>
#include "taichi/common/task.h"
#include "taichi/gui/gui.h"
#include <cctype>
#include <map>
// Note: some code is copied from MSDN:
// https://docs.microsoft.com/en-us/windows/desktop/learnwin32/intr... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/gui/win32.cpp", "license": "mit", "size": 7848} |
### File: taichi/gui/x11.cpp
#include "taichi/gui/gui.h"
#if defined(TI_GUI_X11)
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <cstdlib>
// Undo terrible unprefixed macros in X.h
#ifdef None
#undef None
#endif
#ifdef Success
#undef Success
#endif
TI_NAMESPACE_BEGIN
class CXImage {
pu... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/gui/x11.cpp", "license": "mit", "size": 6783} |
### File: taichi/inc/archs.inc.h
// Potentially supported backends
// CPU archs
PER_ARCH(x64) // a.k.a. AMD64/x86_64
PER_ARCH(arm64) // a.k.a. Aarch64, WIP
PER_ARCH(js) // Javascript, N/A
PER_ARCH(cc) // C language, WIP
// GPU archs
PER_ARCH(cuda) // NVIDIA CUDA
PER_ARCH(metal) // Apple Metal
PER_ARC... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/archs.inc.h", "license": "mit", "size": 435} |
### File: taichi/inc/binary_op.inc.h
PER_BINARY_OP(mul)
PER_BINARY_OP(add)
PER_BINARY_OP(sub)
PER_BINARY_OP(truediv)
PER_BINARY_OP(floordiv)
PER_BINARY_OP(div)
PER_BINARY_OP(mod)
PER_BINARY_OP(max)
PER_BINARY_OP(min)
PER_BINARY_OP(bit_and)
PER_BINARY_OP(bit_or)
PER_BINARY_OP(bit_xor)
PER_BINARY_OP(bit_shl)
PER_BINARY_O... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/binary_op.inc.h", "license": "mit", "size": 514} |
### File: taichi/inc/constants.h
#pragma once
#include <cstddef>
constexpr int taichi_max_num_indices = 8;
constexpr int taichi_max_num_args = 8;
constexpr int taichi_max_num_snodes = 1024;
constexpr int taichi_max_gpu_block_dim = 1024;
constexpr std::size_t taichi_global_tmp_buffer_size = 1024 * 1024;
constexpr int ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/constants.h", "license": "mit", "size": 1184} |
### File: taichi/inc/data_type.inc.h
PER_TYPE(f16)
PER_TYPE(f32)
PER_TYPE(f64)
PER_TYPE(i8)
PER_TYPE(i16)
PER_TYPE(i32)
PER_TYPE(i64)
PER_TYPE(u1) // bool
PER_TYPE(u8)
PER_TYPE(u16)
PER_TYPE(u32)
PER_TYPE(u64)
PER_TYPE(gen) // generic, "void *" when used together with pointer
PER_TYPE(unknown)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/data_type.inc.h", "license": "mit", "size": 260} |
### File: taichi/inc/extensions.inc.h
// Lists of extension features
PER_EXTENSION(sparse) // Sparse data structures
PER_EXTENSION(async_mode) // Asynchronous execution mode
PER_EXTENSION(quant) // Quantization
PER_EXTENSION(quant_basic) // Basic operations in quantization
PER_EXTENSION(data64) //... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/extensions.inc.h", "license": "mit", "size": 598} |
### File: taichi/inc/offloaded_task_type.inc.h
PER_TASK_TYPE(serial)
PER_TASK_TYPE(range_for)
PER_TASK_TYPE(struct_for)
PER_TASK_TYPE(listgen)
PER_TASK_TYPE(gc)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/offloaded_task_type.inc.h", "license": "mit", "size": 114} |
### File: taichi/inc/opengl_extension.inc.h
// Potentially supported OpenGL extensions
PER_OPENGL_EXTENSION(GL_ARB_compute_shader)
PER_OPENGL_EXTENSION(GL_ARB_gpu_shader_int64)
PER_OPENGL_EXTENSION(GL_NV_shader_atomic_float)
PER_OPENGL_EXTENSION(GL_NV_shader_atomic_float64)
PER_OPENGL_EXTENSION(GL_NV_shader_atomic_int... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/opengl_extension.inc.h", "license": "mit", "size": 280} |
### File: taichi/inc/snodes.inc.h
PER_SNODE(root)
PER_SNODE(dense)
PER_SNODE(dynamic)
PER_SNODE(pointer)
PER_SNODE(bitmasked)
PER_SNODE(hash)
PER_SNODE(place)
PER_SNODE(bit_struct)
PER_SNODE(bit_array)
PER_SNODE(undefined)
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/snodes.inc.h", "license": "mit", "size": 189} |
### File: taichi/inc/statements.inc.h
// Frontend statements
PER_STATEMENT(FrontendIfStmt)
PER_STATEMENT(FrontendForStmt)
PER_STATEMENT(FrontendPrintStmt)
PER_STATEMENT(FrontendWhileStmt)
PER_STATEMENT(FrontendBreakStmt)
PER_STATEMENT(FrontendContinueStmt)
PER_STATEMENT(FrontendAllocaStmt)
PER_STATEMENT(FrontendAssignS... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/statements.inc.h", "license": "mit", "size": 2347} |
### File: taichi/inc/unary_op.inc.h
PER_UNARY_OP(neg)
PER_UNARY_OP(sqrt)
PER_UNARY_OP(floor)
PER_UNARY_OP(ceil)
PER_UNARY_OP(cast_value)
PER_UNARY_OP(cast_bits)
PER_UNARY_OP(abs)
PER_UNARY_OP(sgn)
PER_UNARY_OP(sin)
PER_UNARY_OP(asin)
PER_UNARY_OP(cos)
PER_UNARY_OP(acos)
PER_UNARY_OP(tan)
PER_UNARY_OP(tanh)
PER_UNARY_OP... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/inc/unary_op.inc.h", "license": "mit", "size": 434} |
### File: taichi/ir/analysis.h
#pragma once
#include "taichi/ir/ir.h"
#include "taichi/ir/pass.h"
#include "taichi/analysis/gather_uniquely_accessed_pointers.h"
#include <atomic>
#include <optional>
#include <unordered_set>
#include <unordered_map>
namespace taichi {
namespace lang {
class DiffRange {
private:
bo... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/analysis.h", "license": "mit", "size": 6172} |
### File: taichi/ir/basic_stmt_visitor.cpp
#include "taichi/ir/frontend_ir.h"
#include "taichi/ir/statements.h"
#include "taichi/ir/visitors.h"
TLANG_NAMESPACE_BEGIN
BasicStmtVisitor::BasicStmtVisitor() {
allow_undefined_visitor = true;
}
void BasicStmtVisitor::visit(Block *stmt_list) {
std::vector<Stmt *> state... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/basic_stmt_visitor.cpp", "license": "mit", "size": 1835} |
### File: taichi/ir/control_flow_graph.cpp
#include "taichi/ir/control_flow_graph.h"
#include <queue>
#include "taichi/ir/analysis.h"
#include "taichi/ir/statements.h"
#include "taichi/system/profiler.h"
TLANG_NAMESPACE_BEGIN
CFGNode::CFGNode(Block *block,
int begin_location,
int e... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/control_flow_graph.cpp", "license": "mit", "size": 29796} |
### File: taichi/ir/control_flow_graph.h
#pragma once
#include <optional>
#include <unordered_set>
#include "taichi/ir/ir.h"
TLANG_NAMESPACE_BEGIN
// A basic block in control-flow graph
class CFGNode {
private:
// For accelerating get_store_forwarding_data
std::unordered_set<Block *> parent_blocks;
public:
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/control_flow_graph.h", "license": "mit", "size": 3690} |
### File: taichi/ir/expr.cpp
#include "taichi/ir/expr.h"
#include "taichi/ir/frontend_ir.h"
#include "taichi/ir/ir.h"
#include "taichi/program/program.h"
TLANG_NAMESPACE_BEGIN
std::string Expr::serialize() const {
TI_ASSERT(expr);
return expr->serialize();
}
void Expr::set_tb(const std::string &tb) {
expr->tb... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expr.cpp", "license": "mit", "size": 5332} |
### File: taichi/ir/expr.h
#pragma once
#include "taichi/ir/type_utils.h"
TLANG_NAMESPACE_BEGIN
class Expression;
class Identifier;
class ExprGroup;
class SNode;
class Expr {
public:
std::shared_ptr<Expression> expr;
bool const_value;
bool atomic;
Expr() {
const_value = false;
atomic = false;
}
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expr.h", "license": "mit", "size": 2709} |
### File: taichi/ir/expression.cpp
#include "taichi/ir/expression.h"
namespace taichi {
namespace lang {
std::string Expression::get_attribute(const std::string &key) const {
if (auto it = attributes.find(key); it == attributes.end()) {
TI_ERROR("Attribute {} not found.", key);
} else {
return it->second;... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expression.cpp", "license": "mit", "size": 765} |
### File: taichi/ir/expression.h
#pragma once
#include "taichi/ir/ir.h"
#include "taichi/ir/expr.h"
TLANG_NAMESPACE_BEGIN
#include "taichi/ir/expression_ops.h"
// always a tree - used as rvalues
class Expression {
public:
Stmt *stmt;
std::string tb;
std::map<std::string, std::string> attributes;
struct Fl... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expression.h", "license": "mit", "size": 2053} |
### File: taichi/ir/expression_ops.cpp
#include "taichi/ir/frontend.h"
namespace taichi {
namespace lang {
#define TI_EXPRESSION_IMPLEMENTATION
#include "taichi/ir/expression_ops.h"
} // namespace lang
} // namespace taichi
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expression_ops.cpp", "license": "mit", "size": 189} |
### File: taichi/ir/expression_ops.h
// Arithmatic operations
#if defined(TI_EXPRESSION_IMPLEMENTATION)
#undef DEFINE_EXPRESSION_OP_BINARY
#undef DEFINE_EXPRESSION_OP_UNARY
#undef DEFINE_EXPRESSION_FUNC
#define DEFINE_EXPRESSION_OP_UNARY(opname) \
Expr opname(const Expr &expr) { ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/expression_ops.h", "license": "mit", "size": 4114} |
### File: taichi/ir/frontend.cpp
// Frontend constructs
#include "taichi/ir/frontend.h"
#include "taichi/ir/statements.h"
TLANG_NAMESPACE_BEGIN
void layout(const std::function<void()> &body) {
get_current_program().layout(body);
}
Expr global_new(Expr id_expr, DataType dt) {
TI_ASSERT(id_expr.is<IdExpression>()... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/frontend.cpp", "license": "mit", "size": 2997} |
### File: taichi/ir/frontend.h
// Frontend constructs
#pragma once
#include "taichi/common/core.h"
#include "taichi/common/dict.h"
#include "taichi/ir/frontend_ir.h"
namespace taichi {
static_assert(
sizeof(real) == sizeof(float32),
"Please build the taichi compiler with single precision (TI_USE_DOUBLE=0)");
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/frontend.h", "license": "mit", "size": 5822} |
### File: taichi/ir/frontend_ir.cpp
#include "taichi/ir/frontend_ir.h"
#include "taichi/ir/statements.h"
#include "taichi/program/program.h"
TLANG_NAMESPACE_BEGIN
FrontendSNodeOpStmt::FrontendSNodeOpStmt(SNodeOpType op_type,
SNode *snode,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/frontend_ir.cpp", "license": "mit", "size": 13050} |
### File: taichi/ir/frontend_ir.h
#pragma once
#include <string>
#include <vector>
#include "taichi/ir/snode_types.h"
#include "taichi/ir/stmt_op_types.h"
#include "taichi/ir/ir.h"
#include "taichi/ir/expression.h"
TLANG_NAMESPACE_BEGIN
// Frontend Statements
class FrontendAllocaStmt : public Stmt {
public:
Ide... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/frontend_ir.h", "license": "mit", "size": 13557} |
### File: taichi/ir/ir.cpp
#include "taichi/ir/ir.h"
#include <numeric>
#include <thread>
#include <unordered_map>
// #include "taichi/ir/analysis.h"
#include "taichi/ir/statements.h"
#include "taichi/ir/transforms.h"
namespace taichi {
namespace lang {
std::string snode_access_flag_name(SNodeAccessFlag type) {
i... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/ir.cpp", "license": "mit", "size": 13195} |
### File: taichi/ir/ir.h
// Intermediate representation system
#pragma once
#include <atomic>
#include <unordered_set>
#include <unordered_map>
#include <variant>
#include <tuple>
#include "taichi/common/core.h"
#include "taichi/ir/ir_modified.h"
#include "taichi/ir/snode.h"
#include "taichi/ir/type_factory.h"
#incl... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/ir.h", "license": "mit", "size": 18795} |
### File: taichi/ir/ir_builder.cpp
#include "taichi/ir/ir_builder.h"
#include "taichi/ir/statements.h"
#include "taichi/common/logging.h"
TLANG_NAMESPACE_BEGIN
namespace {
inline bool stmt_location_did_not_change(Stmt *stmt, int location) {
return location >= 0 && location < stmt->parent->size() &&
stmt->... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/ir_builder.cpp", "license": "mit", "size": 12164} |
### File: taichi/ir/ir_builder.h
#pragma once
#include "taichi/ir/ir.h"
TLANG_NAMESPACE_BEGIN
class IRBuilder {
public:
struct InsertPoint {
Block *block{nullptr};
int position{0};
};
IRBuilder();
// Clear the IR and the insertion point.
void reset();
// Extract the IR.
std::unique_ptr<IRNo... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/ir_builder.h", "license": "mit", "size": 8277} |
### File: taichi/ir/ir_modified.h
#pragma once
namespace taichi {
namespace lang {
class IRModified {};
} // namespace lang
} // namespace taichi
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/ir_modified.h", "license": "mit", "size": 117} |
### File: taichi/ir/offloaded_task_type.cpp
#include "taichi/ir/offloaded_task_type.h"
TLANG_NAMESPACE_BEGIN
std::string offloaded_task_type_name(OffloadedTaskType tt) {
if (false) {
}
#define PER_TASK_TYPE(x) else if (tt == OffloadedTaskType::x) return #x;
#include "taichi/inc/offloaded_task_type.inc.h"
#undef P... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/offloaded_task_type.cpp", "license": "mit", "size": 342} |
### File: taichi/ir/offloaded_task_type.h
#pragma once
#include "taichi/common/core.h"
#include <string>
TLANG_NAMESPACE_BEGIN
enum class OffloadedTaskType : int {
#define PER_TASK_TYPE(x) x,
#include "taichi/inc/offloaded_task_type.inc.h"
#undef PER_TASK_TYPE
};
std::string offloaded_task_type_name(OffloadedTaskT... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/offloaded_task_type.h", "license": "mit", "size": 308} |
### File: taichi/ir/pass.cpp
#include "taichi/ir/pass.h"
namespace taichi {
namespace lang {
const PassID Pass::id = "undefined";
} // namespace lang
} // namespace taichi
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/pass.cpp", "license": "mit", "size": 148} |
### File: taichi/ir/pass.h
#pragma once
#include "taichi/ir/ir.h"
#include "taichi/program/compile_config.h"
#include <unordered_map>
#include <typeindex>
#include <utility>
namespace taichi {
namespace lang {
using PassID = std::string;
/*class PassContext {
public:
PassContext() {
}
explicit PassContext(C... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/pass.h", "license": "mit", "size": 2056} |
### File: taichi/ir/scratch_pad.cpp
#include "taichi/ir/scratch_pad.h"
#include "taichi/ir/statements.h"
TLANG_NAMESPACE_BEGIN
std::string ScratchPad::global_to_linearized_local(
const std::vector<Stmt *> &loop_vars,
const std::vector<Stmt *> &indices) {
std::string ret = "";
TI_ASSERT((int)indices.size(... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/scratch_pad.cpp", "license": "mit", "size": 651} |
### File: taichi/ir/scratch_pad.h
#pragma once
#include "taichi/ir/snode.h"
TLANG_NAMESPACE_BEGIN
class Stmt;
enum AccessFlag : unsigned int {
read = 1 << 1,
write = 1 << 2,
accumulate = 1 << 3
};
inline AccessFlag operator|(AccessFlag a, AccessFlag b) {
return static_cast<AccessFlag>(static_cast<unsigned>... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/scratch_pad.h", "license": "mit", "size": 6078} |
### File: taichi/ir/snode.cpp
#include "taichi/ir/snode.h"
#include "taichi/ir/ir.h"
#include "taichi/ir/statements.h"
TLANG_NAMESPACE_BEGIN
std::atomic<int> SNode::counter{0};
SNode &SNode::insert_children(SNodeType t) {
TI_ASSERT(t != SNodeType::root);
auto new_ch = std::make_unique<SNode>(depth + 1, t);
n... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/snode.cpp", "license": "mit", "size": 5709} |
### File: taichi/ir/snode.h
#pragma once
#include <atomic>
#include "taichi/inc/constants.h"
#include "taichi/ir/expr.h"
#include "taichi/ir/snode_types.h"
#include "taichi/ir/type.h"
TLANG_NAMESPACE_BEGIN
struct IndexExtractor {
int start;
int num_bits;
int acc_offset;
int num_elements;
int trailing_bits... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/snode.h", "license": "mit", "size": 6873} |
### File: taichi/ir/snode_types.cpp
#include "taichi/ir/snode_types.h"
#include "taichi/common/logging.h"
namespace taichi {
namespace lang {
std::string snode_type_name(SNodeType t) {
switch (t) {
#define PER_SNODE(i) \
case SNodeType::i: \
return #i;
#include "taichi/inc/snodes.inc.h"
#undef PER_SNODE
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/snode_types.cpp", "license": "mit", "size": 469} |
### File: taichi/ir/snode_types.h
#pragma once
#include <string>
namespace taichi {
namespace lang {
enum class SNodeType {
#define PER_SNODE(x) x,
#include "taichi/inc/snodes.inc.h"
#undef PER_SNODE
};
std::string snode_type_name(SNodeType t);
bool is_gc_able(SNodeType t);
} // namespace lang
} // namespace ta... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/snode_types.h", "license": "mit", "size": 291} |
### File: taichi/ir/state_machine.cpp
#include "taichi/ir/state_machine.h"
#include "taichi/ir/statements.h"
#include "taichi/ir/analysis.h"
#include "taichi/ir/ir_modified.h"
TLANG_NAMESPACE_BEGIN
std::unique_ptr<std::unordered_set<AtomicOpStmt *>> StateMachine::used_atomics;
StateMachine::StateMachine(Stmt *var, ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/state_machine.cpp", "license": "mit", "size": 15566} |
### File: taichi/ir/state_machine.h
#pragma once
#include <unordered_set>
#include "taichi/ir/ir.h"
TLANG_NAMESPACE_BEGIN
// State machine for AllocaStmt/GlobalTemporaryStmt/GlobalPtrStmt.
class StateMachine {
private:
Stmt *var;
static std::unique_ptr<std::unordered_set<AtomicOpStmt *>> used_atomics;
bool ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/state_machine.h", "license": "mit", "size": 2349} |
### File: taichi/ir/statements.cpp
// TODO: gradually cppize statements.h
#include "taichi/ir/statements.h"
#include "taichi/util/bit.h"
TLANG_NAMESPACE_BEGIN
bool ContinueStmt::as_return() const {
TI_ASSERT(scope != nullptr);
if (auto *offl = scope->cast<OffloadedStmt>(); offl) {
TI_ASSERT(offl->task_type ==... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/statements.cpp", "license": "mit", "size": 13558} |
### File: taichi/ir/statements.h
#pragma once
#include "taichi/ir/ir.h"
#include "taichi/ir/offloaded_task_type.h"
#include "taichi/ir/stmt_op_types.h"
#include "taichi/program/arch.h"
namespace taichi {
namespace lang {
/**
* Allocate a local variable with initial value 0.
*/
class AllocaStmt : public Stmt {
pub... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/statements.h", "license": "mit", "size": 33324} |
### File: taichi/ir/stmt_op_types.cpp
#include "taichi/ir/stmt_op_types.h"
#include "taichi/common/logging.h"
namespace taichi {
namespace lang {
std::string unary_op_type_name(UnaryOpType type) {
switch (type) {
#define PER_UNARY_OP(i) \
case UnaryOpType::i: \
return #i;
#include "taichi/inc/unary_op.inc.h... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/stmt_op_types.cpp", "license": "mit", "size": 2980} |
### File: taichi/ir/stmt_op_types.h
#pragma once
#include <string>
#include "taichi/common/core.h"
namespace taichi {
namespace lang {
enum class UnaryOpType : int {
#define PER_UNARY_OP(x) x,
#include "taichi/inc/unary_op.inc.h"
#undef PER_UNARY_OP
};
std::string unary_op_type_name(UnaryOpType type);
inline bool... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/stmt_op_types.h", "license": "mit", "size": 1940} |
### File: taichi/ir/transforms.h
#pragma once
#include <atomic>
#include <optional>
#include <unordered_map>
#include <unordered_set>
#include "taichi/ir/control_flow_graph.h"
#include "taichi/ir/ir.h"
#include "taichi/ir/pass.h"
#include "taichi/transforms/check_out_of_bound.h"
#include "taichi/transforms/constant_f... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/transforms.h", "license": "mit", "size": 5216} |
### File: taichi/ir/type.cpp
#include "taichi/ir/type.h"
#include "taichi/ir/type_factory.h"
#include "taichi/ir/type_utils.h"
TLANG_NAMESPACE_BEGIN
// Note: these primitive types should never be freed. They are supposed to live
// together with the process. This is a temporary solution. Later we should
// manage it... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type.cpp", "license": "mit", "size": 10857} |
### File: taichi/ir/type.h
#pragma once
#include "taichi/common/core.h"
#include "taichi/util/bit.h"
TLANG_NAMESPACE_BEGIN
enum class PrimitiveTypeID : int {
#define PER_TYPE(x) x,
#include "taichi/inc/data_type.inc.h"
#undef PER_TYPE
};
class Type {
public:
virtual std::string to_string() const = 0;
template... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type.h", "license": "mit", "size": 8695} |
### File: taichi/ir/type_factory.cpp
#include "taichi/ir/type_factory.h"
#include "taichi/ir/type_utils.h"
TLANG_NAMESPACE_BEGIN
TypeFactory &TypeFactory::get_instance() {
static TypeFactory *type_factory = new TypeFactory;
return *type_factory;
}
TypeFactory::TypeFactory() {
}
Type *TypeFactory::get_primitive... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type_factory.cpp", "license": "mit", "size": 5829} |
### File: taichi/ir/type_factory.h
#pragma once
#include "taichi/ir/type.h"
#include <mutex>
TLANG_NAMESPACE_BEGIN
class TypeFactory {
public:
static TypeFactory &get_instance();
// TODO(type): maybe it makes sense to let each get_X function return X*
// instead of generic Type*
Type *get_primitive_type(... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type_factory.h", "license": "mit", "size": 2159} |
### File: taichi/ir/type_utils.cpp
#include "taichi/ir/type_utils.h"
namespace taichi {
namespace lang {
std::string data_type_name(DataType t) {
if (!t->is<PrimitiveType>()) {
return t->to_string();
}
// Handle primitive types below.
if (false) {
}
#define PER_TYPE(i) else if (t->is_primitive(Primiti... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type_utils.cpp", "license": "mit", "size": 2091} |
### File: taichi/ir/type_utils.h
#pragma once
#include "taichi/ir/type.h"
namespace taichi {
namespace lang {
std::string data_type_name(DataType t);
std::string data_type_format(DataType dt);
int data_type_size(DataType t);
inline int data_type_bits(DataType t) {
return data_type_size(t) * 8;
}
template <type... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/type_utils.h", "license": "mit", "size": 3758} |
### File: taichi/ir/visitors.h
#pragma once
#include "taichi/ir/ir.h"
TLANG_NAMESPACE_BEGIN
// Visits all non-containing statements
class BasicStmtVisitor : public IRVisitor {
public:
BasicStmtVisitor();
virtual void preprocess_container_stmt(Stmt *stmt) {
}
void visit(Block *stmt_list) override;
void v... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/ir/visitors.h", "license": "mit", "size": 714} |
### File: taichi/jit/jit_module.h
#pragma once
#include <memory>
#include <functional>
#include "taichi/inc/constants.h"
#include "taichi/llvm/llvm_fwd.h"
#include "taichi/lang_util.h"
#include "taichi/program/kernel_profiler.h"
TLANG_NAMESPACE_BEGIN
// A architecture-specific JIT module that initializes with an **... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/jit/jit_module.h", "license": "mit", "size": 2795} |
### File: taichi/jit/jit_session.cpp
#include "taichi/jit/jit_session.h"
#include "llvm/IR/DataLayout.h"
TLANG_NAMESPACE_BEGIN
std::unique_ptr<JITSession> create_llvm_jit_session_cpu(Arch arch);
std::unique_ptr<JITSession> create_llvm_jit_session_cuda(Arch arch);
std::unique_ptr<JITSession> JITSession::create(Arch ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/jit/jit_session.cpp", "license": "mit", "size": 743} |
### File: taichi/jit/jit_session.h
#pragma once
#include <memory>
#include <functional>
#include "taichi/llvm/llvm_fwd.h"
#include "taichi/lang_util.h"
#include "taichi/jit/jit_module.h"
TLANG_NAMESPACE_BEGIN
// Backend JIT compiler for all archs
class JITSession {
protected:
std::vector<std::unique_ptr<JITModu... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/jit/jit_session.h", "license": "mit", "size": 796} |
### File: taichi/lang_util.cpp
// Definitions of utility functions and enums
#include "taichi/lang_util.h"
#include "taichi/math/linalg.h"
#include "taichi/program/arch.h"
#include "taichi/program/program.h"
#include "taichi/program/compile_config.h"
#include "taichi/system/timer.h"
TI_NAMESPACE_BEGIN
namespace lan... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/lang_util.cpp", "license": "mit", "size": 2624} |
### File: taichi/lang_util.h
// Definitions of utility functions and enums
#pragma once
#include "taichi/util/io.h"
#include "taichi/common/core.h"
#include "taichi/system/profiler.h"
#include "taichi/ir/ir_modified.h"
#include "taichi/ir/stmt_op_types.h"
#include "taichi/ir/type.h"
#include "taichi/ir/type_utils.h"
#... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/lang_util.h", "license": "mit", "size": 2153} |
### File: taichi/llvm/llvm_codegen_utils.cpp
#include "llvm_codegen_utils.h"
TLANG_NAMESPACE_BEGIN
std::string type_name(llvm::Type *type) {
std::string type_name_str;
llvm::raw_string_ostream rso(type_name_str);
type->print(rso);
return type_name_str;
}
void check_func_call_signature(llvm::Value *func,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/llvm/llvm_codegen_utils.cpp", "license": "mit", "size": 1549} |
### File: taichi/llvm/llvm_codegen_utils.h
#pragma once
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/llvm/llvm_codegen_utils.h", "license": "mit", "size": 6303} |
### File: taichi/llvm/llvm_context.cpp
// A llvm backend helper
#include "taichi/llvm/llvm_context.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/llvm/llvm_context.cpp", "license": "mit", "size": 28013} |
### File: taichi/llvm/llvm_context.h
#pragma once
// llvm backend compiler (x64, arm64, cuda, amdgpu etc)
// in charge of creating & JITing arch-specific LLVM modules,
// and invoking compiled functions (kernels).
// Designed to be multithreaded for parallel compilation.
#include <mutex>
#include <functional>
#includ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/llvm/llvm_context.h", "license": "mit", "size": 3429} |
### File: taichi/llvm/llvm_fwd.h
#pragma once
namespace llvm {
class LLVMContext;
class Type;
class Value;
class Module;
class Function;
class DataLayout;
class JITSymbol;
class ExitOnError;
namespace orc {
class ThreadSafeContext;
}
} // namespace llvm
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/llvm/llvm_fwd.h", "license": "mit", "size": 223} |
### File: taichi/math/arithmetic.h
#pragma once
#include "taichi/common/trait.h"
namespace taichi {
// Round up |a| to the closest multiple of |b|, works only for integers.
template <typename T>
T iroundup(T a, T b) {
if constexpr (std::is_integral_v<T>) {
return ((a + b - 1) / b) * b;
} else {
static_as... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/arithmetic.h", "license": "mit", "size": 586} |
### File: taichi/math/array.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
*******************************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/array.h", "license": "mit", "size": 484} |
### File: taichi/math/array_2d.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
****************************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/array_2d.h", "license": "mit", "size": 17452} |
### File: taichi/math/array_fwd.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
***************************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/array_fwd.h", "license": "mit", "size": 659} |
### File: taichi/math/geometry_util.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
***********************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/geometry_util.h", "license": "mit", "size": 2762} |
### File: taichi/math/linalg.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
******************************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/linalg.h", "license": "mit", "size": 43929} |
### File: taichi/math/math.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
*******************************************************************************/... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/math.h", "license": "mit", "size": 1107} |
### File: taichi/math/scalar.h
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
The use of this software is governed by the LICENSE file.
******************************************************************************... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/scalar.h", "license": "mit", "size": 3574} |
### File: taichi/math/sifakis_svd.h
#include <cmath>
#include <algorithm>
#include "taichi/common/core.h"
namespace SifakisSVD {
/*
http://pages.cs.wisc.edu/~sifakis/project_pages/svd.html
Computing the Singular Value Decomposition of 3x3 matrices with minimal
branching and elementary floating point operations
A. M... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/sifakis_svd.h", "license": "mit", "size": 28723} |
### File: taichi/math/svd.h
#include "taichi/ir/ir.h"
TLANG_NAMESPACE_BEGIN
template <typename Tf, typename Ti>
Expr svd_bitwise_or(const Expr &a, const Expr &b) {
return bit_cast<Tf>(bit_cast<Ti>(a) || bit_cast<Ti>(b));
}
template <typename Tf, typename Ti>
Expr svd_bitwise_xor(const Expr &a, const Expr &b) {
r... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/math/svd.h", "license": "mit", "size": 25201} |
### File: taichi/platform/cuda/detect_cuda.cpp
#include "taichi/platform/cuda/detect_cuda.h"
#if defined(TI_WITH_CUDA)
#include "taichi/backends/cuda/cuda_driver.h"
#endif
namespace taichi {
bool is_cuda_api_available() {
#if defined(TI_WITH_CUDA)
return lang::CUDADriver::get_instance_without_context().detected();... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/platform/cuda/detect_cuda.cpp", "license": "mit", "size": 329} |
### File: taichi/platform/cuda/detect_cuda.h
#pragma once
namespace taichi {
bool is_cuda_api_available();
} // namespace taichi
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/platform/cuda/detect_cuda.h", "license": "mit", "size": 86} |
### File: taichi/platform/mac/objc_api.cpp
#include "objc_api.h"
#ifdef TI_PLATFORM_OSX
namespace taichi {
namespace mac {
nsobj_unique_ptr<TI_NSString> wrap_string_as_ns_string(const std::string &str) {
constexpr int kNSUTF8StringEncoding = 4;
id ns_string = clscall("NSString", "alloc");
auto *ptr = cast_call... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/platform/mac/objc_api.cpp", "license": "mit", "size": 1532} |
### File: taichi/platform/mac/objc_api.h
#include <string>
#include "taichi/common/core.h"
#ifdef TI_PLATFORM_OSX
#include <objc/message.h>
#include <objc/objc.h>
#include <objc/runtime.h>
extern "C" {
void NSLog(/* NSString */ id format, ...);
}
namespace taichi {
namespace mac {
template <typename R, typename O... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/platform/mac/objc_api.h", "license": "mit", "size": 3436} |
### File: taichi/platform/windows/windows.h
#pragma once
#include <windows.h>
// Never directly include <windows.h>. That will bring you evil max/min macros.
#if defined(min)
#undef min
#endif
#if defined(max)
#undef max
#endif
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/platform/windows/windows.h", "license": "mit", "size": 185} |
### File: taichi/program/arch.cpp
#include "taichi/program/arch.h"
TLANG_NAMESPACE_BEGIN
std::string arch_name(Arch arch) {
switch (arch) {
#define PER_ARCH(x) \
case Arch::x: \
return #x; \
break;
#include "taichi/inc/archs.inc.h"
#undef PER_ARCH
default:
TI_NOT_IMPLEMENTED
}
}
Arc... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/arch.cpp", "license": "mit", "size": 1502} |
### File: taichi/program/arch.h
#pragma once
#include <string>
#include "taichi/common/core.h"
TLANG_NAMESPACE_BEGIN
enum class Arch : int {
#define PER_ARCH(x) x,
#include "taichi/inc/archs.inc.h"
#undef PER_ARCH
};
std::string arch_name(Arch arch);
Arch arch_from_name(const std::string &arch);
bool arch_is_cpu... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/arch.h", "license": "mit", "size": 479} |
### File: taichi/program/async_engine.cpp
#include "taichi/program/async_engine.h"
#include <memory>
#include "taichi/program/kernel.h"
#include "taichi/program/program.h"
#include "taichi/system/timeline.h"
#include "taichi/backends/cpu/codegen_cpu.h"
#include "taichi/util/testing.h"
#include "taichi/util/statistics... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/async_engine.cpp", "license": "mit", "size": 9604} |
### File: taichi/program/async_engine.h
#include <atomic>
#include <condition_variable>
#include <deque>
#include <functional>
#include <future>
#include <mutex>
#include <thread>
#include <unordered_map>
#include "taichi/ir/ir.h"
#include "taichi/lang_util.h"
#define TI_RUNTIME_HOST
#include "taichi/program/context.h... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/async_engine.h", "license": "mit", "size": 4742} |
### File: taichi/program/async_profiler_switch.h
#pragma once
#define ASYNC_ENGINE_RELEASE_MODE
#ifdef ASYNC_ENGINE_RELEASE_MODE
#undef TI_PROFILER
#undef TI_AUTO_PROF
#define TI_PROFILER(name)
#define TI_AUTO_PROF
#endif // ASYNC_ENGINE_RELEASE_MODE
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/async_profiler_switch.h", "license": "mit", "size": 206} |
### File: taichi/program/async_utils.cpp
#include "taichi/program/async_utils.h"
#include <queue>
#include <unordered_map>
#include "taichi/ir/transforms.h"
#include "taichi/ir/analysis.h"
#include "taichi/ir/ir.h"
#include "taichi/ir/statements.h"
#include "taichi/program/ir_bank.h"
#include "taichi/program/kernel.h... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/async_utils.cpp", "license": "mit", "size": 14472} |
### File: taichi/program/async_utils.h
#pragma once
#include <atomic>
#include <unordered_map>
#include <unordered_set>
#include <variant>
#include "taichi/ir/snode.h"
#include "taichi/ir/offloaded_task_type.h"
#define TI_RUNTIME_HOST
#include "taichi/program/context.h"
#undef TI_RUNTIME_HOST
TLANG_NAMESPACE_BEGIN
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/async_utils.h", "license": "mit", "size": 5944} |
### File: taichi/program/compile_config.cpp
#include "compile_config.h"
#include <thread>
TLANG_NAMESPACE_BEGIN
CompileConfig::CompileConfig() {
arch = host_arch();
simd_width = default_simd_width(arch);
external_optimization_level = 3;
print_ir = false;
print_accessor_ir = false;
print_evaluator_ir = fa... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/compile_config.cpp", "license": "mit", "size": 1800} |
### File: taichi/program/compile_config.h
#pragma once
#include "arch.h"
#include "taichi/lang_util.h"
TLANG_NAMESPACE_BEGIN
struct CompileConfig {
Arch arch;
bool debug;
bool cfg_optimization;
bool check_out_of_bound;
int simd_width;
bool lazy_compilation;
int external_optimization_level;
int max_ve... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/compile_config.h", "license": "mit", "size": 2073} |
### File: taichi/program/context.h
#pragma once
// Use relative path here for runtime compilation
#include "taichi/inc/constants.h"
#if defined(TI_RUNTIME_HOST)
namespace taichi {
namespace lang {
#endif
struct LLVMRuntime;
// "Context" holds necessary data for kernel body execution, such as a pointer
// to the LLV... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/context.h", "license": "mit", "size": 998} |
### File: taichi/program/extension.cpp
#include "extension.h"
//#include "taichi/backends/opengl/opengl_api.h"
#include <unordered_map>
#include <unordered_set>
TLANG_NAMESPACE_BEGIN
bool is_extension_supported(Arch arch, Extension ext) {
static std::unordered_map<Arch, std::unordered_set<Extension>> arch2ext = {
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/extension.cpp", "license": "mit", "size": 1356} |
### File: taichi/program/extension.h
#pragma once
#include "arch.h"
#include <string>
TLANG_NAMESPACE_BEGIN
// The Taichi core feature set (dense SNode) should probably be supported by all
// the backends. In addition, each backend can optionally support features in
// the extension set.
//
// The notion of core vs... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/extension.h", "license": "mit", "size": 649} |
### File: taichi/program/ir_bank.cpp
#include "taichi/program/ir_bank.h"
#include "taichi/ir/analysis.h"
#include "taichi/ir/statements.h"
#include "taichi/ir/transforms.h"
#include "taichi/ir/analysis.h"
#include "taichi/program/kernel.h"
#include "taichi/program/state_flow_graph.h"
TLANG_NAMESPACE_BEGIN
namespace ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/ir_bank.cpp", "license": "mit", "size": 8044} |
### File: taichi/program/ir_bank.h
#include <set>
#include <unordered_map>
#include <vector>
#include "taichi/program/async_utils.h"
TLANG_NAMESPACE_BEGIN
class StateFlowGraph;
class IRBank {
public:
uint64 get_hash(IRNode *ir);
void set_hash(IRNode *ir, uint64 hash);
bool insert(std::unique_ptr<IRNode> &&i... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/ir_bank.h", "license": "mit", "size": 3002} |
### File: taichi/program/ir_node_extended_impl.cpp
#include "taichi/ir/ir.h"
#include "taichi/program/program.h"
#include "taichi/program/kernel.h"
// TODO(#2196): Part of the implementation of IRNode has to be placed here, in
// order to use files under "taichi/program". Ideally, we should:
// 1. Have a dedicated IR... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/ir_node_extended_impl.cpp", "license": "mit", "size": 624} |
### File: taichi/program/kernel.cpp
#include "kernel.h"
#include "taichi/backends/cuda/cuda_driver.h"
#include "taichi/codegen/codegen.h"
#include "taichi/common/task.h"
#include "taichi/ir/statements.h"
#include "taichi/ir/transforms.h"
#include "taichi/program/async_engine.h"
#include "taichi/program/extension.h"
#i... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/kernel.cpp", "license": "mit", "size": 13413} |
### File: taichi/program/kernel.h
#pragma once
#include "taichi/lang_util.h"
#include "taichi/ir/snode.h"
#include "taichi/ir/ir.h"
#include "taichi/program/arch.h"
#define TI_RUNTIME_HOST
#include "taichi/program/context.h"
#undef TI_RUNTIME_HOST
TLANG_NAMESPACE_BEGIN
class Program;
class Kernel {
public:
std:... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/kernel.h", "license": "mit", "size": 2991} |
### File: taichi/program/kernel_profiler.cpp
#include "kernel_profiler.h"
#include "taichi/system/timer.h"
#include "taichi/backends/cuda/cuda_driver.h"
#include "taichi/system/timeline.h"
TLANG_NAMESPACE_BEGIN
void KernelProfileRecord::insert_sample(double t) {
if (counter == 0) {
min = t;
max = t;
}
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/kernel_profiler.cpp", "license": "mit", "size": 7257} |
### File: taichi/program/kernel_profiler.h
#pragma once
#include "taichi/program/arch.h"
#include "taichi/lang_util.h"
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <memory>
TLANG_NAMESPACE_BEGIN
struct KernelProfileRecord {
std::string name;
int counter;
double min;
doubl... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/Taichi", "path": "taichi/program/kernel_profiler.h", "license": "mit", "size": 1543} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.