Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Introduce a structured, interned HIR type system

Đang mở
#31 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

Start with include/crossgl/HIR/HIR.h, TypeSemantics.h, and docs/architecture/ARCHITECTURE_V2.md. For the first staged foundation, trace the existing HIRType parsing and the three array splitters, then inspect the .cgl fixture corpus and unit-test type set. Done means round-trip and differential tests preserve type spellings and formatType/typeToIR output without golden changes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

HIRType is string-based (include/crossgl/HIR/HIR.h): a single name string overloads the base spelling, qualifier prefixes (buffer /uniform /shared ), pointer suffixes (*), and generics (atomic<int>), while arraySize is a second ][-joined mini-grammar. Type meaning is decoded by re-parsing these strings at ~300 sites across ~38 files, with duplicated isVector/isScalar/isMatrix predicates in several backends and three separate ][ array splitters. This string-typed core caps the optimizer, the HIR verifier, target legalization, and any future native binary backend, and is the single biggest obstacle to a best-in-class typed IR.

Goal

Replace the string-typed HIRType with a structured, interned type model (Type / TypeKind / TypeContext) — scalar class + lane count, matrix shape, qualifier, pointer depth, array dimensions, struct/resource payloads — with O(1) interned equality and one canonical decoder. Enforce strict typing (no implicit int/float, signed/unsigned, vector-width, or address-space conversion) per docs/architecture/ARCHITECTURE_V2.md.

Staged plan (incremental, behind the TypeSemantics.h seam; no big-bang)

  1. This PR — foundation, off the hot path: add Type / TypeKind / TypeContext, internType(const HIRType&) (the single parser, centralizing baseTypeName / stripTypeQualifier / vector-width / array-element logic and the three ][ splitters) and toLegacyHIRType(const Type&) (re-serialize). HIRType storage is unchanged. Proven by a differential round-trip test over the full .cgl fixture corpus + the unit-test type set: toLegacyHIRType(internType(t)) == t, with identical formatType/typeToIR output. Zero golden movement.
  2. Reimplement the TypeSemantics.h predicates on top of Type (same signatures); delete the divergent duplicate predicates.
  3. Migrate HIRType to carry an interned Type handle (string fields become lazy accessors for one release).
  4. Convert the four backend type mappers + typeToIR to switch on TypeKind; rekey the SPIR-V type caches on the handle; remove the legacy string fields.

The compiler keeps accepting the same CrossGL language as the crosstl translator (cross-repo language contract); this is an internal-representation refactor — accepted source and emitted/reflected type spellings are preserved and pinned by the differential tests.

Ngôn ngữ chính
C++
Star
0
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CrossGL/compiler

Tất cả issue của CrossGL/compiler

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.