[PATCH] D158140: WIP: [clang-repl] Basic WebAssembly support for running inside a JS engine

2023-08-24 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. Yes, I think that's the simplest solution. `__EMSCRIPTEN__` probably won't work because somebody may want to build for Emscripten without lld. `STATICALLY_LINKED_LLD` would probably be better. But I could not figure out how to do that in the build system.

[PATCH] D158140: WIP: [clang-repl] Basic WebAssembly support for running inside a JS engine

2023-08-23 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/lib/Interpreter/WASM.cpp:79 + int Result = + lld::wasm::link(LinkerArgs, llvm::outs(), llvm::errs(), false, false); + if (!Result) v.g.vassilev wrote: > I am not sure how we can solve that dependency

[PATCH] D158140: WIP: [clang-repl] Basic WebAssembly support for running inside a JS engine

2023-08-23 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. Here's a demo of it in action with clang and lld linked statically out of tree. https://wasmdemo.argentite.me Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158140/new/ https://reviews.llvm.org/D158140

[PATCH] D158140: WIP: [clang-repl] Basic WebAssembly support for running inside a JS engine

2023-08-16 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added reviewers: v.g.vassilev, sgraenitz, lhames. argentite added a comment. This cannot built yet because it depends on lld which does not seem to usable from clang directly. I am looking for feedback/ideas on how to proceed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D158140: WIP: [clang-repl] Basic WebAssembly support for running inside a JS engine

2023-08-16 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite created this revision. Herald added subscribers: cfe-commits, pmatos, asb, sunfish, jgravelle-google, sbc100, dschuff. Herald added projects: clang, All. argentite requested review of this revision. Herald added a subscriber: aheejin. This commit introduces support for running

[PATCH] D151904: [clang-repl][CUDA] Add an unit test for interactive CUDA

2023-08-24 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite edited the summary of this revision. argentite updated this revision to Diff 553197. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D151904/new/ https://reviews.llvm.org/D151904 Files: clang/unittests/Interpreter/CMakeLists.txt

[PATCH] D151904: [clang-repl][CUDA] Add an unit test for interactive CUDA

2023-08-24 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/unittests/Interpreter/InteractiveCudaTest.cpp:92 + std::unique_ptr Interp = createInterpreter(); + auto Err = Interp->LoadDynamicLibrary("libcudart.so"); + if (Err) { // CUDA runtime is not installed/usable, cannot continue

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-01-16 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite created this revision. Herald added a project: All. argentite added reviewers: v.g.vassilev, lhames, sgraenitz. argentite published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits. This commit adds the %lib command to load a dynamic

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-01-23 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/include/clang/Interpreter/Interpreter.h:62 const CompilerInstance *getCompilerInstance() const; - const llvm::orc::LLJIT *getExecutionEngine() const; + llvm::Expected GetExecutionEngine(); + sgraenitz

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-21 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 507046. argentite marked 3 inline comments as done. argentite edited the summary of this revision. argentite added a comment. Added a simple test and removed the automatic OS specific library filenames Full name/path of the library must be provided. This

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-04-17 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. We should probably also address the lack of linker issue as well. Should we go for a precompiled dynamic library file? There seems to be some "precedent" of this in other tests. Comment at: clang/test/Interpreter/dynamic-library.cpp:6 + +#include

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-22 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 516061. argentite added a comment. Herald added a subscriber: ormris. Use virtual file system to store CUDA fatbinaries in memory Adapted Interpreter tests to use the CompilerBuilder Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D148992: [clang-repl] Fix dynamic library test to avoid cstdio and linker

2023-04-22 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite created this revision. Herald added a project: All. argentite added reviewers: bcain, zhuhan0, sgraenitz, v.g.vassilev. argentite published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits. Some platforms do not have a working linker

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-04-22 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. I made patch with both precompiled library and without cstdio. D148992 @dyung We can also enable this now on PS4/5 if you are interested. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D148992: [clang-repl] Fix dynamic library test to avoid cstdio and linker

2023-04-25 Thread Anubhab Ghosh via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG7f96ce5e133b: [clang-repl] Fix dynamic library test to avoid cstdio and linker (authored by argentite). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D148992: [clang-repl] Fix dynamic library test to avoid cstdio and linker

2023-04-25 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 516715. argentite marked an inline comment as done. argentite added a comment. extern "C" and enable PS4/5 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148992/new/ https://reviews.llvm.org/D148992 Files:

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-23 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/lib/Interpreter/Offload.cpp:1 +//===-- Offload.cpp - CUDA Offloading ---*- C++ -*-===// +// v.g.vassilev wrote: > argentite wrote: > > Hahnfeld wrote: > > > v.g.vassilev wrote: > > > >

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-28 Thread Anubhab Ghosh via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd978730d8e2c: [clang-repl] Add a command to load dynamic libraries (authored by argentite). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141824/new/

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-11 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 512521. argentite marked 3 inline comments as done. argentite added a comment. Combined IncrementalCompilerBuilder and IncrementalCudaCompilerBuilder Added --cuda-path support Use sys::fs::createTemporaryFile() instead of hardcoding the path Other minor

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-11 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/lib/Interpreter/Offload.cpp:90-91 + PTXCode += '\0'; + while (PTXCode.size() % 8) +PTXCode += '\0'; + return PTXCode.str(); Hahnfeld wrote: > Is padding to 8 bytes a requirement for PTX? Maybe add a

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-05 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. In D146389#4243900 , @tra wrote: >> Initial interactive CUDA support for clang-repl > > What should a user expect to be supported, functionality wise? I assume it > should cover parsing and compilation. I'm not so sure about

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-29 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. Hi, @dyung ! It seems the dynamic library generation is failing from the lack of a linker. We need a test library to load at runtime in clang-repl. Do you have any idea how we can create one without a linker? Otherwise we can disable the test on PS4 as it is probably

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-29 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added a comment. Just to confirm, `UNSUPPORTED: target=x86_64-scei-ps4` should be enough, right? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141824/new/ https://reviews.llvm.org/D141824 ___

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-04-04 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite created this revision. Herald added subscribers: mattd, carlosgalvezp, yaxunl. Herald added a project: All. argentite updated this revision to Diff 507049. argentite added a comment. argentite updated this revision to Diff 510808. argentite edited the summary of this revision. argentite

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-28 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/test/Interpreter/dynamic-library.cpp:1 +// RUN: head -n 7 %s | %clang -xc++ -o %T/libdynamic-library-test.so -fPIC -shared - +int ultimate_answer = 0; v.g.vassilev wrote: > sgraenitz wrote: > > The use of

[PATCH] D141824: [clang-repl] Add a command to load dynamic libraries

2023-03-28 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 508971. argentite marked an inline comment as done. argentite added a comment. Changed test to use a separate Input file for the dynamic library generation Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-27 Thread Anubhab Ghosh via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGddeab07ca632: [clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl (authored by argentite). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D151904: [clang-repl][CUDA] Add an unit test for interactive CUDA

2023-06-01 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/unittests/Interpreter/InteractiveCudaTest.cpp:92 + std::unique_ptr Interp = createInterpreter(); + auto Err = Interp->LoadDynamicLibrary("libcudart.so"); + if (Err) { // CUDA runtime is not installed/usable, cannot continue

[PATCH] D151904: [clang-repl][CUDA] Add an unit test for interactive CUDA

2023-06-01 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite created this revision. argentite added a reviewer: v.g.vassilev. Herald added subscribers: mattd, carlosgalvezp, yaxunl. Herald added a project: All. argentite requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. This tests

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-25 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 525572. argentite added a comment. Workaround for depending on NVPTX symbols: initialize all available targets instead. If NVPTX is not available, it will complain when we try to actually execute anything in CUDA mode. Rebased and fixed conflicts on

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-13 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite added inline comments. Comment at: clang/lib/CodeGen/ModuleBuilder.cpp:39 const PreprocessorOptions // Only used for debug info. -const CodeGenOptions CodeGenOpts; // Intentionally copied in. +CodeGenOptions CodeGenOpts; // Intentionally copied in.

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-14 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 522041. argentite added a comment. Remove the copy of CodeGenOpts in CodeGeneratorImpl Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146389/new/ https://reviews.llvm.org/D146389 Files:

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-16 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 522717. argentite added a comment. Update the filenames Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146389/new/ https://reviews.llvm.org/D146389 Files: clang/include/clang/Interpreter/Interpreter.h

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-12 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 521742. argentite marked an inline comment as done. argentite added a comment. Add some CUDA basic functionality tests. Disallow undo-ing of the initial PTU. This should fix the undo command test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-09 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 520636. argentite marked 3 inline comments as done. argentite added a comment. Added a check to run CUDA tests only on systems with CUDA. We need some ideas for the actual tests. Rename Offload.cpp to DeviceOffload.cpp Other syntax/style fixes

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-20 Thread Anubhab Ghosh via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG80e7eed6a610: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl (authored by argentite). Changed prior to commit:

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-20 Thread Anubhab Ghosh via Phabricator via cfe-commits
argentite updated this revision to Diff 524006. argentite added a comment. Added some std::move fixes for Error -> Expected conversions We need to figure out a solution when NVPTX backend is not enabled. clang-repl probably should not depends on that. Example: