1DOLLY 82PACKAGE mojo3REQUIRES HOST runtime@0456789FROM /demos/mojo/Dollyfile-mojo-llvm d24080a0e2a58d5665ab05d7b391654860590569348531a1637aba45daecf7571011INSTALL /Dollyfile-libdolly-gpu e3d09def5ec1b5113da429c6165bc288646fbd48dda2bdb6471e22e2d8867b3f12INSTALL /Dollyfile-cc 3c50048026aec1c0c21ac6c0b74d93f53b5c0a3fa83b5c9930d86924a3b59eaa131415USE /demos/tools/Dollyfile-fmt 99497886647d758ab09efd99bb518614ce57c30e7ce15c144a3a13eaec82572316USE /demos/mojo/Dollyfile-xxhash e6c0894c4beeca848ff3913723e56952dd79e6d2dd7652707f71a50f33a8f58117USE /demos/mojo/Dollyfile-opentelemetry-cpp a0a949daddf02db45bdd1374e07e4dc6f8bbee2d610fb3428e62ab22c53ef9ae18REQUIRES HEADER gpu19REQUIRES LIB dolly-gpu20REQUIRES TOOL cmake21REQUIRES TOOL make22REQUIRES TOOL python23REQUIRES TOOL cc24REQUIRES TOOL c++25REQUIRES TOOL ar26REQUIRES TOOL gzip27REQUIRES TOOL tar28REQUIRES TOOL patch29REQUIRES TOOL time30REQUIRES TOOL cp31REQUIRES TOOL mkdir32REQUIRES TOOL rm33REQUIRES TOOL sha256sum34REQUIRES TOOL cut3536SOURCE /dist/static/mojo/mojo.tar.gz 1ea25ace732e78db2f48d1110f233f33067e068875762719c7117ea3f10d9ae4 /tmp/mojo.tar.gz37SLOP slop -c 'gzip -dc /tmp/mojo.tar.gz | tar -xf - -C /'3839SLOP patch -p1 -d /tmp/mojo/modular -i /tmp/mojo/mojo-dolly.patch404142SLOP patch -p1 -d /tmp/mojo/modular -i /tmp/mojo/target/patches/compiler.patch43SLOP patch -p1 -d /tmp/mojo/modular -i /tmp/mojo/target/patches/stdlib.patch4445SLOP slop -c 'python /tmp/mojo/bazel-to-cmake.py /tmp/mojo/modular > /tmp/mojo/CMakeLists.txt'4647484950FILE /tmp/mojo/Dolly.cmake51 set(CMAKE_BUILD_TYPE Release CACHE STRING "")52 set(CMAKE_C_FLAGS "-std=gnu17" CACHE STRING "")53 set(CMAKE_CXX_FLAGS "-include endian.h -DCLANG_BUILD_STATIC" CACHE STRING "")54 set(CMAKE_EXE_LINKER_FLAGS "-Wl,--initial-memory=67108864" CACHE STRING "")55 set(CMAKE_RULE_MESSAGES OFF CACHE BOOL "")56 set(MOJO_SOURCE /tmp/mojo/modular CACHE PATH "")57 set(MOJO_PORT /tmp/mojo/port CACHE PATH "")58 set(MOJO_LLVM /opt/mojo-llvm CACHE PATH "")59 set(MOJO_VERSION_LABEL "" CACHE STRING "")606162SLOP time slop -c 'cmake -C /tmp/mojo/Dolly.cmake -DMODULAR_VERSION_REVISION=c6fa49f7+dolly.$(sha256sum /tmp/mojo.tar.gz | cut -c1-8) -S /tmp/mojo -B /tmp/mojo/build'63646566SLOP CWD /tmp/mojo/build time make -k -j3 Mojo.tools.mojo.mojo67SLOP mkdir -p /usr/lib/mojo /usr/share/licenses/mojo68SLOP cp /tmp/mojo/build/mojo /usr/bin/mojo69SLOP /usr/bin/mojo --version7071SLOP time /usr/bin/mojo precompile -o /usr/lib/mojo/std.mojoc /tmp/mojo/modular/Mojo/stdlib/std72SLOP time /usr/bin/mojo precompile -I /usr/lib/mojo -o /usr/lib/mojo/gpu.mojoc /tmp/mojo/target/gpu7374SLOP cp /tmp/mojo/modular/LICENSE /usr/share/licenses/mojo/LICENSE75SLOP cp /opt/mojo-llvm/LICENSE.TXT /usr/share/licenses/mojo/LICENSE.llvm76SLOP cp /usr/share/licenses/zstd/LICENSE /usr/share/licenses/mojo/LICENSE.zstd77SLOP cp /usr/share/licenses/fmt/LICENSE /usr/share/licenses/mojo/LICENSE.fmt78SLOP cp /usr/share/licenses/xxhash/LICENSE /usr/share/licenses/mojo/LICENSE.xxhash79SLOP cp /usr/share/licenses/opentelemetry-cpp/LICENSE /usr/share/licenses/mojo/LICENSE.opentelemetry80818283FILE /tmp/mojo-runtime/runtime.c84 /* The compiler runtime of a Mojo program in Dolly: the KGEN_CompilerRT_*85 * functions that the standard library and the compiler's output call.86 *87 * Upstream's is Mojo/lib/CompilerRT, over AsyncRT's thread pool, tcmalloc,88 * Support and LLVMSupport. This one is its interface over libc for one89 * thread: a task runs when something waits for it, and the parallelism level90 * is 1. A string argument is a pointer and a length, as the compiler emits a91 * two-word struct for wasm64. Python interoperation is absent, so a program92 * that uses it does not link. */93949596979899100 101 /* Memory */102 103 void *KGEN_CompilerRT_AlignedAlloc(int64_t alignment, int64_t size) {104 void *memory = NULL;105 if (alignment <= 0) alignment = 16;106 if (alignment < (int64_t)sizeof(void *)) alignment = sizeof(void *);107 return posix_memalign(&memory, (size_t)alignment, size > 0 ? (size_t)size : 1) ? NULL : memory;108 }109 110 void KGEN_CompilerRT_AlignedFree(void *memory) { free(memory); }111 112 /* Globals, destroyed latest first */113 114 struct global {115 struct global *next;116 size_t length;117 void *value;118 void (*destroy)(void *);119 char name[];120 };121 122 enum { INDEXED_GLOBALS = 3 };123 static struct global *globals;124 static struct { void *value; void (*destroy)(void *); } indexed[INDEXED_GLOBALS];125 126 void *KGEN_CompilerRT_GetOrCreateGlobal(const char *name, size_t length, void *(*create)(void),127 void (*destroy)(void *)) {128 for (struct global *entry = globals; entry; entry = entry->next) {129 if (entry->length == length && !memcmp(entry->name, name, length)) return entry->value;130 }131 if (!create) return NULL;132 void *value = create();133 struct global *entry = malloc(sizeof *entry + length);134 if (!entry) abort();135 *entry = (struct global){globals, length, value, destroy};136 memcpy(entry->name, name, length);137 globals = entry;138 return value;139 }140 141 void *KGEN_CompilerRT_GetGlobalOrNull(const char *name, size_t length) {142 return KGEN_CompilerRT_GetOrCreateGlobal(name, length, NULL, NULL);143 }144 145 static void *inserted;146 static void *take_inserted(void) { return inserted; }147 148 void KGEN_CompilerRT_InsertGlobal(const char *name, size_t length, void *value) {149 inserted = value;150 KGEN_CompilerRT_GetOrCreateGlobal(name, length, take_inserted, NULL);151 }152 153 void *KGEN_CompilerRT_GetOrCreateGlobalIndexed(size_t index, void *(*create)(void), void (*destroy)(void *)) {154 if (index >= INDEXED_GLOBALS) abort();155 if (!indexed[index].value) {156 indexed[index].value = create();157 indexed[index].destroy = destroy;158 }159 return indexed[index].value;160 }161 162 void KGEN_CompilerRT_DestroyGlobals(void) {163 while (globals) {164 struct global *entry = globals;165 globals = entry->next;166 if (entry->destroy && entry->value) entry->destroy(entry->value);167 free(entry);168 }169 for (size_t index = 0; index < INDEXED_GLOBALS; index++) {170 void *value = indexed[index].value;171 indexed[index].value = NULL;172 if (value && indexed[index].destroy) indexed[index].destroy(value);173 }174 }175 176 /* Clang names a C program's main(argc, argv) __main_argc_argv for Wasm, and177 * libc calls that. Mojo names its entry point main. */178 int mojo_main(int, char **) __asm__("main");179 int __main_argc_argv(int count, char **values) { return mojo_main(count, values); }180 181 /* Arguments */182 183 struct string { const char *bytes; size_t length; };184 struct argument_list { struct string *list; size_t count; };185 static struct string no_arguments = {"", 0}, *arguments = &no_arguments;186 static size_t argument_count = 1;187 188 void KGEN_CompilerRT_SetArgV(int count, char **values) {189 struct string *list = calloc(count > 0 ? (size_t)count : 1, sizeof *list);190 if (!list) abort();191 for (int i = 0; i < count; i++) list[i] = (struct string){values[i], strlen(values[i])};192 arguments = list;193 argument_count = (size_t)count;194 }195 196 void KGEN_CompilerRT_GetArgV(struct argument_list *result) {197 result->list = arguments;198 result->count = argument_count;199 }200 201 /* The environment for a spawned process: Mojo cannot name a C variable,202 * and Dolly's dlsym, which upstream asks on Linux, belongs to programs that203 * load modules. Dolly's patch of the standard library calls this. */204 extern char **environ;205 char **KGEN_CompilerRT_Environ(void) { return environ; }206 207 /* The system */208 209 size_t KGEN_CompilerRT_NumPhysicalCores(void) { return 1; }210 size_t KGEN_CompilerRT_NumLogicalCores(void) { return 1; }211 size_t KGEN_CompilerRT_NumPerformanceCores(void) { return 1; }212 213 int KGEN_CompilerRT_fprintf(FILE *stream, const char *format, ...) {214 va_list values;215 va_start(values, format);216 int result = vfprintf(stream, format, values);217 va_end(values);218 return result;219 }220 221 /* A fault in Wasm is a trap: the process ends with status 126 and one line222 * from Dolly's supervisor. There is no signal to print a stack trace from. */223 void KGEN_CompilerRT_PrintStackTraceOnFault(void) {}224 225 /* As upstream answers while stack traces on errors are not configured. */226 int64_t KGEN_CompilerRT_GetStackTrace(char **text, int64_t depth) {227 (void)text;228 (void)depth;229 return 0;230 }231 232 void KGEN_CompilerRT_SetAsanAllocators(void) {}233 234 /* Tasks: one queue, run by whoever waits */235 236 struct task {237 struct task *next;238 void (*resume)(void *);239 void *handle;240 };241 242 struct chain {243 bool ready;244 struct task *waiting;245 };246 247 static struct task *first_task, **last_task = &first_task;248 static char device;249 static void *current_device;250 251 static void enqueue(struct task *task) {252 task->next = NULL;253 *last_task = task;254 last_task = &task->next;255 }256 257 static bool run_one(void) {258 struct task *task = first_task;259 if (!task) return false;260 first_task = task->next;261 if (!first_task) last_task = &first_task;262 void (*resume)(void *) = task->resume;263 void *handle = task->handle;264 free(task);265 resume(handle);266 return true;267 }268 269 static struct task *new_task(void (*resume)(void *), void *handle) {270 struct task *task = malloc(sizeof *task);271 if (!task) abort();272 *task = (struct task){NULL, resume, handle};273 return task;274 }275 276 void KGEN_CompilerRT_AsyncRT_InitializeChain(struct chain **chain) {277 *chain = calloc(1, sizeof **chain);278 if (!*chain) abort();279 }280 281 void KGEN_CompilerRT_AsyncRT_DestroyChain(struct chain **chain) {282 free(*chain);283 *chain = NULL;284 }285 286 void KGEN_CompilerRT_AsyncRT_Complete(struct chain **chain) {287 (*chain)->ready = true;288 while ((*chain)->waiting) {289 struct task *task = (*chain)->waiting;290 (*chain)->waiting = task->next;291 enqueue(task);292 }293 }294 295 void KGEN_CompilerRT_AsyncRT_Wait(struct chain **chain) {296 while (!(*chain)->ready) {297 if (!run_one()) {298 fputs("mojo: waiting for a task that nothing will complete\n", stderr);299 abort();300 }301 }302 }303 304 bool KGEN_CompilerRT_AsyncRT_Wait_Timeout(struct chain **chain, int64_t nanoseconds) {305 struct timespec start, now;306 clock_gettime(CLOCK_MONOTONIC, &start);307 while (!(*chain)->ready && run_one()) {308 clock_gettime(CLOCK_MONOTONIC, &now);309 if ((now.tv_sec - start.tv_sec) * 1000000000 + (now.tv_nsec - start.tv_nsec) >= nanoseconds) break;310 }311 return (*chain)->ready;312 }313 314 void KGEN_CompilerRT_AsyncRT_Execute(void (*resume)(void *), void *handle, int64_t worker) {315 (void)worker;316 enqueue(new_task(resume, handle));317 }318 319 void KGEN_CompilerRT_AsyncRT_AndThen(void (*resume)(void *), struct chain **chain, void *handle) {320 struct task *task = new_task(resume, handle);321 if ((*chain)->ready) {322 enqueue(task);323 } else {324 task->next = (*chain)->waiting;325 (*chain)->waiting = task;326 }327 }328 329 void *KGEN_CompilerRT_AsyncRT_GetOrCreateCPUDevice(void) { return current_device = &device; }330 void *KGEN_CompilerRT_AsyncRT_GetCurrentCPUDevice(void) { return current_device; }331 void KGEN_CompilerRT_AsyncRT_ReleaseCPUDevice(void *released) { (void)released; }332 uint32_t KGEN_CompilerRT_AsyncRT_ParallelismLevel(void) { return 1; }333 334 /* A spin waiter waits for another task: here, by running one. */335 void *KGEN_CompilerRT_AsyncRT_InitializeSpinWaiter(void) { return &device; }336 void KGEN_CompilerRT_AsyncRT_SpinWaiter_Wait(void *waiter) {337 (void)waiter;338 run_one();339 }340 void KGEN_CompilerRT_AsyncRT_DestroySpinWaiter(void *waiter) { (void)waiter; }341342FILE /tmp/mojo-runtime/gpu.c343 /* The device side of the Mojo package `gpu` (gpu.host.DeviceContext) over344 * Dolly's gpu@0. A kernel is WGSL as the compiler's webgpu target prints it:345 * pointer parameters are storage buffers bound in order, the other parameters346 * are 32-bit slots of one more buffer, block_dim is the workgroup size, and347 * what it prints are records of a last buffer, `log`. */348349350351352353354355 356 enum { STORAGE = 128 | 4 | 8, READBACK = 1 | 8, CHUNK = 512 * 1024 };357 358 static dolly_gpu g;359 static uint64_t next = 1;360 361 static int64_t done(void) { return dolly_gpu_batch(&g) < 0 ? -errno : 0; }362 363 int64_t mojo_gpu_open(void) {364 if (g.scope) return 0;365 return dolly_gpu_open(&g, 0, 0) < 0 ? -errno : 0;366 }367 368 int64_t mojo_gpu_buffer(uint64_t bytes) {369 uint64_t id = next++;370 dolly_gpu_begin(&g);371 dolly_gpu_buffer(&g, id, (bytes + 3) & ~(uint64_t)3, STORAGE);372 int64_t error = done();373 return error ? error : (int64_t)id;374 }375 376 int64_t mojo_gpu_release(uint64_t id) {377 dolly_gpu_begin(&g);378 void *record = dolly_gpu_record(&g, DOLLY_GPU_RELEASE, 16);379 memcpy((char *)record + 8, &id, 8);380 return done();381 }382 383 int64_t mojo_gpu_write(uint64_t buffer, uint64_t offset, const void *data, uint64_t bytes) {384 for (uint64_t at = 0; at < bytes; at += CHUNK) {385 uint32_t size = bytes - at < CHUNK ? (uint32_t)(bytes - at) : CHUNK;386 /* WebGPU writes whole 32-bit words: the tail of a buffer of bytes is387 * padded with the zeros of the record, into the buffer's own padding. */388 uint32_t padded = (size + 3) & ~3u;389 dolly_gpu_begin(&g);390 char *record = dolly_gpu_record(&g, DOLLY_GPU_WRITE_BUFFER, 32 + padded);391 uint64_t target = offset + at;392 uint32_t data_offset = 32;393 memcpy(record + 8, &buffer, 8);394 memcpy(record + 16, &target, 8);395 memcpy(record + 24, &data_offset, 4);396 memcpy(record + 28, &padded, 4);397 memcpy(record + 32, (const char *)data + at, size);398 int64_t error = done();399 if (error) return error;400 }401 return 0;402 }403 404 /* gpu@0 maps at most 16 MiB at once and answers 64 KiB a call. */405 static int64_t read_mapped(uint64_t buffer, uint64_t offset, char *data, uint64_t bytes) {406 uint64_t staging = next++, size = (bytes + 3) & ~(uint64_t)3;407 dolly_gpu_begin(&g);408 dolly_gpu_buffer(&g, staging, size, READBACK);409 char *copy = dolly_gpu_record(&g, DOLLY_GPU_COPY_BUFFER, 48);410 memcpy(copy + 8, &buffer, 8);411 memcpy(copy + 16, &staging, 8);412 memcpy(copy + 24, &offset, 8);413 memcpy(copy + 40, &size, 8);414 dolly_gpu_submit(&g);415 dolly_gpu_map(&g, staging, size);416 int64_t error = done();417 for (uint64_t at = 0; !error && at < bytes; at += DOLLY_GPU_REPLY_BYTES) {418 uint64_t part = bytes - at < DOLLY_GPU_REPLY_BYTES ? bytes - at : DOLLY_GPU_REPLY_BYTES;419 if (dolly_gpu_read(&g, staging, at, part) != (int)part) error = errno ? -errno : -EIO;420 else memcpy(data + at, g.reply, part);421 }422 int64_t released = mojo_gpu_release(staging);423 return error ? error : released;424 }425 426 int64_t mojo_gpu_read(uint64_t buffer, uint64_t offset, void *data, uint64_t bytes) {427 enum { MAPPED = 16 * 1024 * 1024 };428 for (uint64_t at = 0; at < bytes; at += MAPPED) {429 int64_t error = read_mapped(buffer, offset + at, (char *)data + at, bytes - at < MAPPED ? bytes - at : MAPPED);430 if (error) return error;431 }432 return 0;433 }434 435 /* One shader module per kernel text and one pipeline per block_dim of it. */436 static struct { const char *code; uint64_t shader, pipeline; uint32_t block[3]; } kernels[64];437 438 static int64_t pipeline(const char *code, uint64_t bytes, const uint32_t block[3]) {439 uint64_t shader = 0;440 unsigned free = 64;441 for (unsigned i = 0; i < 64; i++) {442 if (!kernels[i].code) { if (free == 64) free = i; continue; }443 if (kernels[i].code != code) continue;444 shader = kernels[i].shader;445 if (!memcmp(kernels[i].block, block, sizeof kernels[i].block)) return (int64_t)kernels[i].pipeline;446 }447 if (free == 64) return -ENOSPC;448 dolly_gpu_begin(&g);449 if (!shader) {450 shader = next++;451 char *record = dolly_gpu_record(&g, DOLLY_GPU_CREATE_SHADER, 24 + bytes);452 uint32_t length = (uint32_t)bytes;453 memcpy(record + 8, &shader, 8);454 memcpy(record + 16, &length, 4);455 memcpy(record + 24, code, bytes);456 }457 /* COMPUTE_CONSTANTS: the entry "kernel", then block_x, block_y, block_z. */458 uint64_t id = next++;459 char *record = dolly_gpu_record(&g, DOLLY_GPU_COMPUTE_CONSTANTS, 40 + 3 * 24);460 uint32_t entry = 6, count = 3;461 memcpy(record + 8, &id, 8);462 memcpy(record + 16, &shader, 8);463 memcpy(record + 24, &entry, 4);464 memcpy(record + 28, &count, 4);465 memcpy(record + 32, "kernel", 6);466 for (unsigned axis = 0; axis < 3; axis++) {467 char *constant = record + 40 + axis * 24;468 uint32_t name = 7;469 double value = block[axis];470 memcpy(constant, &name, 4);471 memcpy(constant + 8, &value, 8);472 memcpy(constant + 16, "block_x", 7);473 constant[22] += (char)axis;474 }475 int64_t error = done();476 if (error) return error;477 kernels[free].code = code;478 kernels[free].shader = shader;479 kernels[free].pipeline = id;480 memcpy(kernels[free].block, block, sizeof kernels[free].block);481 return (int64_t)id;482 }483 484 /* A kernel's log: the words its records take, then each record's thread,485 * its length in bytes and its text. One that does not fit has no text. */486 enum { LOG_WORDS = 16 * 1024 };487 static const char log_binding[] = ") var<storage, read_write> log:";488 static uint64_t log_buffer;489 490 static int by_thread(const void *a, const void *b) {491 const uint32_t *left = *(const uint32_t *const *)a, *right = *(const uint32_t *const *)b;492 return left[0] != right[0] ? (left[0] < right[0] ? -1 : 1) : (left > right) - (left < right);493 }494 495 /* Writes what the kernel that has just run printed, thread after thread. */496 static int64_t print_log(void) {497 static uint32_t words[LOG_WORDS];498 static const uint32_t *records[LOG_WORDS / 2];499 int64_t error = mojo_gpu_read(log_buffer, 0, words, sizeof words);500 if (error) return error;501 unsigned count = 0, lost = 0;502 for (uint64_t at = 1; at <= words[0] && at + 2 <= LOG_WORDS; at += 2 + ((uint64_t)words[at + 1] + 3) / 4) {503 if (at + 2 + ((uint64_t)words[at + 1] + 3) / 4 <= LOG_WORDS) records[count++] = words + at;504 else lost = 1;505 }506 qsort(records, count, sizeof *records, by_thread);507 for (unsigned i = 0; i < count; i++) fwrite(records[i] + 2, 1, records[i][1], stdout);508 fflush(stdout);509 if (lost || words[0] > LOG_WORDS - 1) fputs("mojo: a kernel printed more than its 64 KiB of log\n", stderr);510 return 0;511 }512 513 int64_t mojo_gpu_launch(const char *code, uint64_t bytes, const uint32_t grid[3], const uint32_t block[3],514 const uint64_t *buffers, const uint64_t *sizes, uint32_t buffer_count,515 const uint32_t *slots, uint32_t slot_count) {516 int logs = memmem(code, bytes, log_binding, sizeof log_binding - 1) != 0;517 if (buffer_count + !!slot_count + logs > DOLLY_GPU_MAX_BINDINGS) return -E2BIG;518 int64_t compute = pipeline(code, bytes, block);519 if (compute < 0) return compute;520 uint64_t bound[DOLLY_GPU_MAX_BINDINGS], bound_sizes[DOLLY_GPU_MAX_BINDINGS], arguments = 0;521 memcpy(bound, buffers, buffer_count * 8);522 /* A kernel reads whole 32-bit words, also of a buffer of bytes. */523 for (unsigned i = 0; i < buffer_count; i++) bound_sizes[i] = (sizes[i] + 3) & ~(uint64_t)3;524 dolly_gpu_begin(&g);525 if (slot_count) {526 arguments = next++;527 dolly_gpu_buffer(&g, arguments, slot_count * 4, STORAGE);528 dolly_gpu_write(&g, arguments, slots, slot_count * 4);529 bound[buffer_count] = arguments;530 bound_sizes[buffer_count++] = slot_count * 4;531 }532 if (logs) {533 uint32_t empty = 0;534 if (!log_buffer) dolly_gpu_buffer(&g, log_buffer = next++, LOG_WORDS * 4, STORAGE);535 dolly_gpu_write(&g, log_buffer, &empty, 4);536 bound[buffer_count] = log_buffer;537 bound_sizes[buffer_count++] = LOG_WORDS * 4;538 }539 uint64_t group = next++;540 dolly_gpu_group(&g, group, (uint64_t)compute, buffer_count, bound, bound_sizes);541 char *record = dolly_gpu_record(&g, DOLLY_GPU_COMPUTE, 40);542 memcpy(record + 8, &compute, 8);543 memcpy(record + 16, &group, 8);544 memcpy(record + 24, grid, 12);545 dolly_gpu_submit(&g);546 int64_t error = done();547 if (!error && logs) error = print_log();548 if (error) return error;549 error = mojo_gpu_release(group);550 return error || !arguments ? error : mojo_gpu_release(arguments);551 }552 553 int64_t mojo_gpu_synchronize(void) { return dolly_gpu_wait(&g) < 0 ? -errno : 0; }554 555 /* What the device admits of a launch: the threads of a block, its x, y and556 * z, the workgroups of a dimension, the storage buffers of a kernel. */557 int64_t mojo_gpu_limits(uint32_t limits[6]) {558 static uint32_t known[6];559 if (!known[0]) {560 if (dolly_gpu_capabilities(&g) < 72) return errno ? -errno : -EIO;561 memcpy(known, g.reply + 44, 20);562 memcpy(known + 5, g.reply + 68, 4);563 }564 memcpy(limits, known, sizeof known);565 return 0;566 }567568SLOP cc -O2 -Wall -Wextra -Werror -c /tmp/mojo-runtime/runtime.c -o /tmp/mojo-runtime/runtime.o569SLOP cc -O2 -Wall -Wextra -Werror -c /tmp/mojo-runtime/gpu.c -o /tmp/mojo-runtime/gpu.o570SLOP ar rcs /usr/lib/libmojo-rt.a /tmp/mojo-runtime/runtime.o571SLOP ar rcs /usr/lib/libmojo-gpu.a /tmp/mojo-runtime/gpu.o572SLOP rm -rf /tmp/mojo /tmp/mojo.tar.gz /tmp/mojo-runtime573574575576577578579FILE /etc/modular/modular.cfg580 [mojo-max]581 package_root = /usr582 import_path = /usr/lib/mojo583 compilerrt_path = /usr/lib/libmojo-rt.a584 shared_libs = -lmojo-gpu,-ldolly-gpu585EXPORTS TOOL mojo586EXPORTS LIB mojo-rt /usr/lib/libmojo-rt.a587EXPORTS LIB mojo-gpu /usr/lib/libmojo-gpu.a588EXPORTS FOLDER mojo-packages /usr/lib/mojo589EXPORTS FOLDER mojo-licenses /usr/share/licenses/mojo590FILE /usr/share/man/cat1/mojo.1591 mojo: the Mojo compiler built inside Dolly, with its standard library, the592 package gpu and the cc package it links with.593 594 mojo build NAME.mojo && ./NAME compiles a program for Dolly, then runs it595 mojo precompile -o P.mojoc DIR makes a package; -I finds it596 mojo doc, mojo demangle as upstream's597 598 mojo run and mojo NAME.mojo run a program through a JIT, which a WebAssembly599 process cannot do: they refuse and print the line above. mojo repl and mojo600 debug need LLDB, which is not built, and mojo format a formatter that is not601 installed. The only target is Dolly's (wasm64). A program that imports gpu602 runs where the image has gpu@0, as mojo-gpu does; elsewhere it is refused603 with status 126. The compiler runs on one thread.604