lc_vstl

Documents vstd container APIs including HashMap, pools, queues, and smart pointers for LuisaCompute.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers working in the LuisaCompute codebase need a quick reference for the custom vstd container library, whose types and APIs differ from the C++ standard library and are not covered by general C++ documentation.

Core Features & Use Cases

  • Container API Reference: Covers HashMap, ArenaHashMap, object pools, lock-free and single-thread queues, StackAllocator, and vector helpers with exact signatures.
  • Utility Coverage: Documents smart pointers, variant, optional, string utilities, hashing, ranges, and allocation functions like vengine_malloc.
  • Use Case: When writing a LuisaCompute backend module that needs a fast key-value store, consult this guide to correctly use vstd::HashMap with try_emplace, force_emplace, and iterator semantics instead of guessing the API.

Quick Start

Ask the assistant to show how to insert and look up entries in a vstd HashMap within LuisaCompute code.

Frequently Asked Questions about lc_vstl

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

FAQPage Schema
How do I use vstd HashMap in LuisaCompute?▼

Include luisa/vstl/hash_map.h and create vstd::HashMap<Key, Value>. Use try_emplace to insert if absent, force_emplace to insert or overwrite, and find to look up entries returning an index with key() and value() accessors.

What is the difference between vstd HashMap and ArenaHashMap?▼

ArenaHashMap is arena-backed and requires trivially destructible key and value types, while HashMap supports general types. ArenaHashMap only supports key-based removal and lacks custom Index removal.

Does vstd provide thread-safe queues?▼

Yes, LockFreeArrayQueue is a mostly lock-free circular queue using a spin mutex on resize, with blocking enqueue and non-blocking try_pop. SingleThreadArrayQueue is an SPSC queue with no locking for single-producer single-consumer use.

How do vstd smart pointers differ from std smart pointers?▼

vstd::unique_ptr is created via make_unique or create_unique which adopts raw pointers freed with vengine_free. If the pointee derives from IDisposable, Dispose() is called on destruction, unlike std::unique_ptr.

When should I use vstd Pool instead of direct allocation?▼

Use vstd::Pool when repeatedly creating and destroying objects of one type, since it reuses memory via a free list. Pool<T, true> suits trivially destructible types, while Pool<T, false> tracks live objects and supports iteration.