Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当采用xmake构建,启用cpu后端来运行时,会出现 'swapchain context is not initialized' 错误 #146

Closed
hanasaki666 opened this issue May 5, 2024 · 2 comments
Assignees

Comments

@hanasaki666
Copy link

hanasaki666 commented May 5, 2024

Describe the bug

报错信息:

panic occurred: 'swapchain context is not initialized' in file 'luisa_compute_backend_impl\src\cpu\mod.rs' at line 190

我尝试过以clang-cl和llvm作为toolchain,都会出现这个panic,而使用cmake构建是能正常运行的,我怀疑可能是xmake构建时一些构建配置没能正确传递给rust那边

为了能成功构建,我改了scripts\xmake_func.lua里对 “Windows SDK”的要求:

if #vers > 2 then
    --if tonumber(vers[3]) >= 22000 then 这行是原代码,被我注释掉了
    if tonumber(vers[3]) >= 20348 then
        legal_sdk = true
    end
end

构建时使用的scripts\options.lua

lc_toolchain = {
	toolchain = "clang-cl",
}
function get_options()
	return {
		cpu_backend = true,
		enable_api = true,
		-- enable_clangcxx = true,
		enable_custom_malloc = true,
		enable_ir = true,
	}
end

生成的.xmake\windows\x64\xmake.conf

{
    __toolchains_windows_x64 = {
        "clang-cl"
    },
    _lc_bin_dir = [[bin\release]],
    _lc_check_env = true,
    _lc_enable_py = false,
    _lc_enable_rust = true,
    arch = "x64",
    bin_dir = "bin",
    buildir = "build",
    ccache = true,
    clean = true,
    cpu_backend = true,
    cuda = [[D:\cuda]],
    cuda_backend = true,
    cuda_ext_lcub = false,
    dx_backend = true,
    enable_api = true,
    enable_clangcxx = false,
    enable_custom_malloc = true,
    enable_dsl = true,
    enable_gui = true,
    enable_ir = true,
    enable_mimalloc = true,
    enable_osl = true,
    enable_simd = true,
    enable_tests = true,
    enable_unity_build = true,
    external_marl = false,
    host = "windows",
    kind = "static",
    metal_backend = false,
    mode = "release",
    ndk_stdcxx = true,
    network = "public",
    plat = "windows",
    proxy_pac = "pac.lua",
    py_include = false,
    py_libs = false,
    py_linkdir = false,
    sdk_dir = false,
    theme = "default",
    toolchain = "clang-cl",
    vk_backend = false,
    vs = "2022"
}

Expected behavior
可以成功以cpu作为后端来运行需要swapchain的tests(比如test_path_tracing)

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 22H2
@hanasaki666 hanasaki666 changed the title 当采用xmake,工具链为clang-cl,启用cpu后端来编译时,能成功编译,但以cpu作为后端运行需要swapchain的tests会报错 当采用xmake,工具链为clang-cl,启用cpu后端来编译时,能成功编译,但以cpu作为后端运行需要swapchain的tests(比如test_path_tracing)会报错 May 5, 2024
@hanasaki666 hanasaki666 changed the title 当采用xmake,工具链为clang-cl,启用cpu后端来编译时,能成功编译,但以cpu作为后端运行需要swapchain的tests(比如test_path_tracing)会报错 当采用xmake构建,启用cpu后端来运行时,会出现 'swapchain context is not initialized' 错误 May 10, 2024
@Mike-Leo-Smith
Copy link
Contributor

@MaxwellGengYF 请帮忙检查

@MaxwellGengYF
Copy link
Collaborator

Fixed in next branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants