Skip to content

[Script] Add pointer arthematic #237

Merged
yaoyaoding merged 5 commits intohidet-org:mainfrom
yaoyaoding:pointer-constant
May 23, 2023
Merged

[Script] Add pointer arthematic #237
yaoyaoding merged 5 commits intohidet-org:mainfrom
yaoyaoding:pointer-constant

Conversation

@yaoyaoding
Copy link
Copy Markdown
Member

def test_const_pointer():
    from hidet.lang import attrs, void_p, printf, int32

    with hidet.script_module() as script_module:

        @hidet.script
        def func():
            attrs.func_kind = 'host_kernel'

            v = int32(0)  # int32 v = 0;
            p_int32 = ~v  # int32* p_int32 = &v;
            p_void = void_p(p_int32)  # void* p_void = (void*)p_int32;
            printf("%p\n", p_void)

            p_void_0 = void_p(0)  # void* p_void_0 = (void*)0;
            printf("%p\n", p_void_0)

            p_void_1 = p_void_0 + 1
            p_void_2 = p_void_1 - 1
            printf("%p\n", p_void_1)
            printf("%p\n", p_void_2)
            printf("%d\n", p_void_1 == p_void_2)
            printf("%d\n", p_void_1 == p_void_2 + 1)
            printf("%p\n", p_int32 + 1)

    func = script_module.build()
    func()
0x7ffdc4cbeb2c
(nil)
0x1
0x2
0
0
0x7ffdc4cbeb30

@yaoyaoding yaoyaoding merged commit 36e39d0 into hidet-org:main May 23, 2023
@yaoyaoding yaoyaoding deleted the pointer-constant branch May 23, 2023 04:27
vadiklyutiy added a commit that referenced this pull request Jul 22, 2024
…tions (#237)

`mode` argument of `torch.compile` now inherits and set the corresponding
hidet options (`search_space` and `use_cude_graph`)
vadiklyutiy added a commit that referenced this pull request Jul 23, 2024
…tions (#237)

`mode` argument of `torch.compile` now inherits and set the corresponding
hidet options (`search_space` and `use_cude_graph`)
vadiklyutiy added a commit that referenced this pull request Dec 26, 2024
…tions (#237)

`mode` argument of `torch.compile` now inherits and set the corresponding
hidet options (`search_space` and `use_cude_graph`)
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

Successfully merging this pull request may close these issues.

1 participant