lc_core

Reference LuisaCompute core library APIs for types, math, logging, fibers, and STL containers.

1.0k|108|Updated Nov 20, 2020
One-click install
npx skills add https://github.com/LuisaGroup/LuisaCompute --skill lc-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lc_core
Source: https://github.com/LuisaGroup/LuisaCompute/tree/main/.agents/skills/lc_core
Command: npx skills add https://github.com/LuisaGroup/LuisaCompute --skill lc-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers working with the LuisaCompute C++ framework need quick, accurate access to its core library APIs—basic types, math functions, logging, fiber-based parallelism, and custom STL containers—without digging through headers or unit tests.

Core Features & Use Cases

  • Type System Reference: Covers scalar/vector/matrix types (float2, float4x4), type traits (is_vector_v, vector_element_t), and make_* construction helpers.
  • Math & Utilities: Documents vector/matrix math (dot, cross, inverse, transpose), transformations (translation, rotation, scaling), interpolation (lerp, clamp), plus Clock, logging macros, and binary I/O streams.
  • Concurrency & Containers: Explains the fiber scheduler, parallel/async_parallel loops, events and counters, pool and first-fit allocators, and the luisa:: STL container family (unordered_map, fixed_vector, lru_cache).
  • Use Case: When writing a LuisaCompute host-side application, ask how to run a parallel loop over 1000 elements with fibers, and get the exact luisa::fiber::parallel call pattern with scheduler setup.

Quick Start

Ask how to use a specific LuisaCompute core API, such as creating a float4x4 transformation matrix or running a fiber-based parallel loop, and receive the correct header and code pattern.

Frequently Asked Questions about lc_core

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create vectors and matrices in LuisaCompute?

Use aliases like float2, float3, float4 for vectors and float2x2, float3x3, float4x4 for matrices from <luisa/core/basic_types.h>. Construct them with make_float3(1,2,3) or make_float4x4 with row-major values; matrices default to identity.

How do I run a parallel for loop with LuisaCompute fibers?

Create a luisa::fiber::scheduler, then call luisa::fiber::parallel(count, lambda) for blocking execution or luisa::fiber::async_parallel for asynchronous execution returning a counter. The header is <luisa/core/fiber.h>, built on marl.

What logging macros does LuisaCompute provide?

LuisaCompute provides LUISA_VERBOSE, LUISA_INFO, and LUISA_WARNING macros with fmt-style {} formatting, plus _WITH_LOCATION variants that include source location. Set verbosity with luisa::log_level_info() and related functions from <luisa/core/logging.h>.

Does LuisaCompute have its own STL containers?

Yes, the luisa namespace wraps std or EASTL containers under include/luisa/core/stl/, including vector, unordered_map, fixed_vector, lru_cache, optional, and variant. The implementation depends on the LUISA_USE_SYSTEM_STL build option.

How do I load a dynamic library in LuisaCompute?

Use luisa::DynamicModule::load(name) from <luisa/core/dynamic_module.h>, then retrieve symbols with address() or function<T>(). You can add search paths with DynamicModule::add_search_path before loading.

What matrix math operations are available in LuisaCompute?

The mathematics header provides transpose, inverse, and determinant for 2x2/3x3/4x4 matrices, plus float4x4 builders like translation, scaling, and rotation. Vector operations include dot, cross, normalize, length, and distance.