Skip to content

Commit b7a619b

Browse files
authored
Replace the word stdlib or standard-library with core-module for source code (#5415)
This commit changes the word "stdlib" or "standard library" to "core module" in the source code.
1 parent 8047160 commit b7a619b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+221
-221
lines changed

prelude/slang-cpp-scalar-intrinsics.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ SLANG_FORCE_INLINE uint64_t U64_abs(uint64_t f) { return f; }
431431
SLANG_FORCE_INLINE uint64_t U64_min(uint64_t a, uint64_t b) { return a < b ? a : b; }
432432
SLANG_FORCE_INLINE uint64_t U64_max(uint64_t a, uint64_t b) { return a > b ? a : b; }
433433

434-
// TODO(JS): We don't define countbits for 64bit in stdlib currently.
434+
// TODO(JS): We don't define countbits for 64bit in the core module currently.
435435
// It's not clear from documentation if it should return 32 or 64 bits, if it exists.
436436
// 32 bits can always hold the result, and will be implicitly promoted.
437437
SLANG_FORCE_INLINE uint32_t U64_countbits(uint64_t v)

prelude/slang-cuda-prelude.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ struct RWByteAddressBuffer
13481348
memcpy((char*)data + index, &value, sizeof(T));
13491349
}
13501350

1351-
/// Can be used in stdlib to gain access
1351+
/// Can be used in the core module to gain access
13521352
template <typename T>
13531353
SLANG_CUDA_CALL T* _getPtrAt(size_t index)
13541354
{

source/slang-core-module/slang-embedded-core-module-source.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ namespace Slang
288288
if (!coreLibraryCode)
289289
{
290290
StringBuilder sb;
291-
const String path = getStdlibPath();
291+
const String path = getCoreModulePath();
292292
#include "core.meta.slang.h"
293293
coreLibraryCode = StringBlob::moveCreate(sb);
294294
}
@@ -301,7 +301,7 @@ namespace Slang
301301
#if SLANG_EMBED_CORE_MODULE_SOURCE
302302
if (!hlslLibraryCode)
303303
{
304-
const String path = getStdlibPath();
304+
const String path = getCoreModulePath();
305305
StringBuilder sb;
306306
#include "hlsl.meta.slang.h"
307307
hlslLibraryCode = StringBlob::moveCreate(sb);
@@ -315,7 +315,7 @@ namespace Slang
315315
#if SLANG_EMBED_CORE_MODULE_SOURCE
316316
if (!autodiffLibraryCode)
317317
{
318-
const String path = getStdlibPath();
318+
const String path = getCoreModulePath();
319319
StringBuilder sb;
320320
#include "diff.meta.slang.h"
321321
autodiffLibraryCode = StringBlob::moveCreate(sb);
@@ -328,7 +328,7 @@ namespace Slang
328328
{
329329
if (!glslLibraryCode)
330330
{
331-
const String path = getStdlibPath();
331+
const String path = getCoreModulePath();
332332
StringBuilder sb;
333333
#include "glsl.meta.slang.h"
334334
glslLibraryCode = StringBlob::moveCreate(sb);

source/slang/hlsl.meta.slang

+22-22
Original file line numberDiff line numberDiff line change
@@ -2405,12 +2405,12 @@ for (int isArray = 0; isArray <= 1; isArray++)
24052405
for (int isMS = 0; isMS <= 1; isMS++) {
24062406
if (isMS)
24072407
{
2408-
if (shapeIndex != kStdlibShapeIndex2D)
2408+
if (shapeIndex != kCoreModule_ShapeIndex2D)
24092409
continue;
24102410
}
24112411
if (isArray)
24122412
{
2413-
if (shapeIndex == kStdlibShapeIndex3D)
2413+
if (shapeIndex == kCoreModule_ShapeIndex3D)
24142414
continue;
24152415
}
24162416
auto shapeTypeName = kTextureShapeTypeNames[shapeIndex];
@@ -3025,7 +3025,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,0,isShadow,isCombined,format>
30253025
{
30263026
//@hidden:
30273027
static const int isMS = 0;
3028-
static const int access = $(kStdlibResourceAccessReadOnly);
3028+
static const int access = $(kCoreModule_ResourceAccessReadOnly);
30293029
//@public:
30303030
__glsl_extension(GL_EXT_samplerless_texture_functions)
30313031
[__readNone]
@@ -3258,7 +3258,7 @@ __generic<T, Shape: __ITextureShape, let isArray:int, let sampleCount:int, let i
32583258
extension _Texture<T,Shape,isArray,1,sampleCount,0,isShadow,isCombined,format>
32593259
{
32603260
//@hidden:
3261-
static const int access = $(kStdlibResourceAccessReadOnly);
3261+
static const int access = $(kCoreModule_ResourceAccessReadOnly);
32623262
static const int isMS = 1;
32633263
//@public:
32643264
__glsl_extension(GL_EXT_samplerless_texture_functions)
@@ -3432,7 +3432,7 @@ extension _Texture<T,Shape,isArray,1,sampleCount,0,isShadow,isCombined,format>
34323432

34333433
// Load/Subscript for readwrite textures
34343434
${{{{
3435-
for (int access = kStdlibResourceAccessReadWrite; access<=kStdlibResourceAccessRasterizerOrdered; access++) {
3435+
for (int access = kCoreModule_ResourceAccessReadWrite; access <= kCoreModule_ResourceAccessRasterizerOrdered; access++) {
34363436
const char* glslIntrinsic = "$cimageLoad($0, $1)$z";
34373437
const char* glslIntrinsicOffset = "$cimageLoad($0, ($1)+($2))$z";
34383438
const char* glslIntrinsicMS = "$cimageLoad($0, $1, $2)$z";
@@ -3748,7 +3748,7 @@ extension _Texture<T,Shape,isArray,0,sampleCount,$(access),isShadow, 0,format>
37483748
}
37493749

37503750
${{{{
3751-
if (access == kStdlibResourceAccessReadWrite) {
3751+
if (access == kCoreModule_ResourceAccessReadWrite) {
37523752
}}}}
37533753

37543754
// RW MS textures.
@@ -3901,7 +3901,7 @@ extension _Texture<T,Shape,isArray,1,sampleCount,$(access),isShadow, 0,format>
39013901
}
39023902

39033903
${{{{
3904-
} // if (access == kStdlibResourceAccessReadWrite) // for RW MS textures.
3904+
} // if (access == kCoreModule_ResourceAccessReadWrite) // for RW MS textures.
39053905
} // for (access).
39063906
}}}}
39073907

@@ -3983,13 +3983,13 @@ ${{{{
39833983
for (int isArray = 0; isArray<=1; isArray++)
39843984
for (int isMS = 0; isMS<=1; isMS++)
39853985
for (int isCombined = 0; isCombined<=1; isCombined++)
3986-
for (int access = kStdlibResourceAccessReadOnly; access<=kStdlibResourceAccessFeedback; access++) {
3987-
if (access != kStdlibResourceAccessReadOnly)
3986+
for (int access = kCoreModule_ResourceAccessReadOnly; access <= kCoreModule_ResourceAccessFeedback; access++) {
3987+
if (access != kCoreModule_ResourceAccessReadOnly)
39883988
{
39893989
// No RW Cube.
3990-
if (shape == kStdlibShapeIndexCube) continue;
3990+
if (shape == kCoreModule_ShapeIndexCube) continue;
39913991
}
3992-
if (access == kStdlibResourceAccessFeedback)
3992+
if (access == kCoreModule_ResourceAccessFeedback)
39933993
{
39943994
// Feedback only defined for Texture2D and Texture2DArray.
39953995
if (shape != 1) continue;
@@ -3999,14 +3999,14 @@ ${{{{
39993999
if (isMS)
40004000
{
40014001
// Only Texture2DMS.
4002-
if (shape != kStdlibShapeIndex2D)
4002+
if (shape != kCoreModule_ShapeIndex2D)
40034003
continue;
40044004
// Only Texture2DMS or RWTexture2DMS.
4005-
if (access >= kStdlibShapeIndex3D)
4005+
if (access >= kCoreModule_ShapeIndex3D)
40064006
continue;
40074007
}
40084008
// No 3D Array.
4009-
if (shape == kStdlibShapeIndex3D && isArray == 1)
4009+
if (shape == kCoreModule_ShapeIndex3D && isArray == 1)
40104010
continue;
40114011
const char* textureTypeName = isCombined ? "Sampler" : "Texture";
40124012
}}}}
@@ -9924,7 +9924,7 @@ __generic<T : __BuiltinIntegerType>
99249924
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, sm_4_0_version)]
99259925
T max(T x, T y)
99269926
{
9927-
// Note: a stdlib implementation of `max` (or `min`) will require splitting
9927+
// Note: a core module implementation of `max` (or `min`) will require splitting
99289928
// floating-point and integer cases apart, because the floating-point
99299929
// version needs to correctly handle the case where one of the inputs
99309930
// is not-a-number.
@@ -15159,7 +15159,7 @@ struct BuiltInTriangleIntersectionAttributes
1515915159
// 10.2 Shaders
1516015160

1516115161
// Right now new shader stages need to be added directly to the compiler
15162-
// implementation, rather than being something that can be declared in the stdlib.
15162+
// implementation, rather than being something that can be declared in the core module.
1516315163

1516415164
// 10.3 - Intrinsics
1516515165

@@ -16058,7 +16058,7 @@ struct SAMPLER_FEEDBACK_MIP_REGION_USED : __BuiltinSamplerFeedbackType {};
1605816058
// All of these objects are write-only resources that point to a special kind of unordered access view meant for sampler feedback.
1605916059

1606016060
__generic<T:__BuiltinSamplerFeedbackType>
16061-
extension _Texture<T,__Shape2D, 0, 0, 0, $(kStdlibResourceAccessFeedback), 0, 0, 0>
16061+
extension _Texture<T,__Shape2D, 0, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
1606216062
{
1606316063
// With Clamp
1606416064

@@ -16138,7 +16138,7 @@ extension _Texture<T,__Shape2D, 0, 0, 0, $(kStdlibResourceAccessFeedback), 0, 0,
1613816138
};
1613916139

1614016140
__generic<T:__BuiltinSamplerFeedbackType>
16141-
extension _Texture<T,__Shape2D, 1, 0, 0, $(kStdlibResourceAccessFeedback), 0, 0, 0>
16141+
extension _Texture<T,__Shape2D, 1, 0, 0, $(kCoreModule_ResourceAccessFeedback), 0, 0, 0>
1614216142
{
1614316143
// With Clamp
1614416144

@@ -19254,7 +19254,7 @@ ${
1925419254
// We introduce a few convenience type aliases here,
1925519255
// which both keep our declarations simpler and easier
1925619256
// to understand, but which might *also* be useful to
19257-
// users of the stdlib, so that they can write things
19257+
// users of the standard module, so that they can write things
1925819258
// like `Texture2D.Footprint`, and also have auto-complete
1925919259
// help them find such members.
1926019260
//
@@ -19273,7 +19273,7 @@ ${
1927319273
// parameter to the query operation(s). We define
1927419274
// the GLSL functions here as intrinsics, so that
1927519275
// we can refer to them later in the definitions
19276-
// of our stdlib operaitons.
19276+
// of our standard module operaitons; not just in glsl module.
1927719277
//
1927819278
// Note: despite the GLSL extension defining the `granularity`
1927919279
// member of the query result as having type `uint`, the
@@ -19606,7 +19606,7 @@ for(auto levelChoice : kLevelChoices)
1960619606

1960719607
${
1960819608
// We now define the portable operations that will be officially
19609-
// supported by the standard library. For each operation, we
19609+
// supported by the standard module. For each operation, we
1961019610
// need to provide both a version that maps to the GLSL extension,
1961119611
// and a version that uses the NVAPI functions.
1961219612
//
@@ -19850,7 +19850,7 @@ ${{{{
1985019850

1985119851
//<T, Shape: __ITextureShape, let isArray:int, let isMS:int, let sampleCount:int, let access:int, let isShadow:int, let isCombined:int, let format:int>
1985219852
__generic<Shape:__ITextureShape1D2D3D, let format : int>
19853-
extension _Texture<float, Shape, 0, 0, 0, $(kStdlibResourceAccessReadWrite), 0, 0, format>
19853+
extension _Texture<float, Shape, 0, 0, 0, $(kCoreModule_ResourceAccessReadWrite), 0, 0, format>
1985419854
{
1985519855
[__requiresNVAPI]
1985619856
[ForceInline]

source/slang/slang-api.cpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ SLANG_API SlangSession* spCreateSession(const char*)
2222
return globalSession.detach();
2323
}
2424

25-
// Attempt to load a previously compiled stdlib from the same file system location as the slang dll.
25+
// Attempt to load a previously compiled core module from the same file system location as the slang dll.
2626
// Returns SLANG_OK when the cache is sucessfully loaded.
27-
// Also returns the filename to the stdlib cache and the timestamp of current slang dll.
28-
SlangResult tryLoadStdLibFromCache(
27+
// Also returns the filename to the core module cache and the timestamp of current slang dll.
28+
SlangResult tryLoadCoreModuleFromCache(
2929
slang::IGlobalSession* globalSession,
3030
Slang::String& outCachePath,
3131
uint64_t& outTimestamp)
@@ -35,7 +35,7 @@ SlangResult tryLoadStdLibFromCache(
3535
uint64_t currentLibTimestamp =
3636
Slang::SharedLibraryUtils::getSharedLibraryTimestamp((void*)slang_createGlobalSession);
3737
auto dirName = Slang::Path::getParentDirectory(fileName);
38-
auto cacheFileName = Slang::Path::combine(dirName, "slang-stdlib.bin");
38+
auto cacheFileName = Slang::Path::combine(dirName, "slang-core-module.bin");
3939
outTimestamp = currentLibTimestamp;
4040
outCachePath = cacheFileName;
4141
if (currentLibTimestamp == 0)
@@ -45,7 +45,7 @@ SlangResult tryLoadStdLibFromCache(
4545
Slang::ScopedAllocation cacheData;
4646
SLANG_RETURN_ON_FAIL(Slang::File::readAllBytes(cacheFileName, cacheData));
4747

48-
// The first 8 bytes stores the timestamp of the slang dll that created this stdlib cache.
48+
// The first 8 bytes stores the timestamp of the slang dll that created this core module cache.
4949
if (cacheData.getSizeInBytes() < sizeof(uint64_t))
5050
return SLANG_FAIL;
5151
auto cacheTimestamp = *(uint64_t*)(cacheData.getData());
@@ -57,22 +57,22 @@ SlangResult tryLoadStdLibFromCache(
5757
return SLANG_OK;
5858
}
5959

60-
SlangResult trySaveStdLibToCache(
60+
SlangResult trySaveCoreModuleToCache(
6161
slang::IGlobalSession* globalSession,
6262
const Slang::String& cacheFilename,
6363
uint64_t dllTimestamp)
6464
{
6565
if (dllTimestamp != 0 && cacheFilename.getLength() != 0)
6666
{
67-
Slang::ComPtr<ISlangBlob> stdLibBlobPtr;
67+
Slang::ComPtr<ISlangBlob> coreModuleBlobPtr;
6868
SLANG_RETURN_ON_FAIL(
69-
globalSession->saveCoreModule(SLANG_ARCHIVE_TYPE_RIFF_LZ4, stdLibBlobPtr.writeRef()));
69+
globalSession->saveCoreModule(SLANG_ARCHIVE_TYPE_RIFF_LZ4, coreModuleBlobPtr.writeRef()));
7070

7171
Slang::FileStream fileStream;
7272
SLANG_RETURN_ON_FAIL(fileStream.init(cacheFilename, Slang::FileMode::Create));
7373

7474
SLANG_RETURN_ON_FAIL(fileStream.write(&dllTimestamp, sizeof(dllTimestamp)));
75-
SLANG_RETURN_ON_FAIL(fileStream.write(stdLibBlobPtr->getBufferPointer(), stdLibBlobPtr->getBufferSize()))
75+
SLANG_RETURN_ON_FAIL(fileStream.write(coreModuleBlobPtr->getBufferPointer(), coreModuleBlobPtr->getBufferSize()))
7676
}
7777

7878
return SLANG_OK;
@@ -85,37 +85,37 @@ SLANG_API SlangResult slang_createGlobalSession(
8585
Slang::ComPtr<slang::IGlobalSession> globalSession;
8686

8787
#ifdef SLANG_ENABLE_IR_BREAK_ALLOC
88-
// Set inst debug alloc counter to 0 so IRInsts for stdlib always starts from a large value.
88+
// Set inst debug alloc counter to 0 so IRInsts for core module always starts from a large value.
8989
Slang::_debugGetIRAllocCounter() = 0x80000000;
9090
#endif
9191

9292
SLANG_RETURN_ON_FAIL(slang_createGlobalSessionWithoutCoreModule(apiVersion, globalSession.writeRef()));
9393

94-
// If we have the embedded stdlib, load from that, else compile it
95-
ISlangBlob* stdLibBlob = slang_getEmbeddedCoreModule();
96-
if (stdLibBlob)
94+
// If we have the embedded core module, load from that, else compile it
95+
ISlangBlob* coreModuleBlob = slang_getEmbeddedCoreModule();
96+
if (coreModuleBlob)
9797
{
98-
SLANG_RETURN_ON_FAIL(globalSession->loadCoreModule(stdLibBlob->getBufferPointer(), stdLibBlob->getBufferSize()));
98+
SLANG_RETURN_ON_FAIL(globalSession->loadCoreModule(coreModuleBlob->getBufferPointer(), coreModuleBlob->getBufferSize()));
9999
}
100100
else
101101
{
102102
Slang::String cacheFilename;
103103
uint64_t dllTimestamp = 0;
104-
#define SLANG_PROFILE_STDLIB_COMPILE 0
105-
#if SLANG_PROFILE_STDLIB_COMPILE
104+
#define SLANG_PROFILE_CORE_MODULE_COMPILE 0
105+
#if SLANG_PROFILE_CORE_MODULE_COMPILE
106106
auto startTime = std::chrono::high_resolution_clock::now();
107107
#else
108-
if (tryLoadStdLibFromCache(globalSession, cacheFilename, dllTimestamp) != SLANG_OK)
108+
if (tryLoadCoreModuleFromCache(globalSession, cacheFilename, dllTimestamp) != SLANG_OK)
109109
#endif
110110
{
111111
// Compile std lib from embeded source.
112112
SLANG_RETURN_ON_FAIL(globalSession->compileCoreModule(0));
113-
#if SLANG_PROFILE_STDLIB_COMPILE
113+
#if SLANG_PROFILE_CORE_MODULE_COMPILE
114114
auto timeElapsed = std::chrono::high_resolution_clock::now() - startTime;
115-
printf("stdlib compilation time: %.1fms\n", timeElapsed.count() / 1000000.0);
115+
printf("core module compilation time: %.1fms\n", timeElapsed.count() / 1000000.0);
116116
#endif
117-
// Store the compiled stdlib to cache file.
118-
trySaveStdLibToCache(globalSession, cacheFilename, dllTimestamp);
117+
// Store the compiled core module to cache file.
118+
trySaveCoreModuleToCache(globalSession, cacheFilename, dllTimestamp);
119119
}
120120
}
121121

source/slang/slang-ast-base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class Val : public NodeBase
458458
}
459459
List<ValNodeOperand> m_operands;
460460

461-
// Private use by stdlib deserialization only. Since we know the Vals serialized into stdlib is already
461+
// Private use by the core module deserialization only. Since we know the Vals serialized into the core module is already
462462
// unique, we can just use `this` pointer as the `m_resolvedVal` so we don't need to resolve them again.
463463
void _setUnique();
464464
protected:

source/slang/slang-ast-builder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ ASTBuilder::ASTBuilder(SharedASTBuilder* sharedASTBuilder, const String& name):
229229
{
230230
SLANG_ASSERT(sharedASTBuilder);
231231
// Copy Val deduplication map over so we don't create duplicate Vals that are already
232-
// existent in the stdlib.
232+
// existent in the core module.
233233
m_cachedNodes = sharedASTBuilder->getInnerASTBuilder()->m_cachedNodes;
234234
}
235235

source/slang/slang-ast-builder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class SharedASTBuilder : public RefObject
8989
Type* m_overloadedType = nullptr;
9090

9191
// The following types are created lazily, such that part of their definition
92-
// can be in the standard library
92+
// can be in the core module.
9393
//
9494
// Note(tfoley): These logically belong to `Type`,
9595
// but order-of-declaration stuff makes that tricky

0 commit comments

Comments
 (0)