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

Questions on gpuRelu #223

Open
SkyTu opened this issue Jul 5, 2024 · 0 comments
Open

Questions on gpuRelu #223

SkyTu opened this issue Jul 5, 2024 · 0 comments

Comments

@SkyTu
Copy link

SkyTu commented Jul 5, 2024

Hello, I am currently reviewing the function gpuRelu in /GPU-MPC/fss/gpu_relu.cu and I am confused about its implementation. Specifically, I am trying to understand why the function tries to compute Relu(x - p) + q.

In /GPU-MPC/tests/fss/relu.cu, it appears that p and q are both set to (1<<16) - 1.

// Relu(x-p) + q, where x-p is guaranteed to be small
template <typename TIn, typename TOut, u64 p, u64 q, bool flipDRelu>
TOut *gpuRelu(SigmaPeer *peer, int party, GPUReluKey<TOut> &k, TIn *d_I, AESGlobalContext *gaes, Stats *s)
{   
    // std::cout << "calling gpuRelu" << std::endl;
    auto &dreluKey = k.dreluKey;
    std::vector<u32 *> h_mask({dreluKey.mask});
    auto d_drelu = gpuDcf<TIn, 1, dReluPrologue<p>, dReluEpilogue<p, flipDRelu>>(dreluKey.dpfKey, party, d_I, gaes, s, &h_mask);
    peer->reconstructInPlace(d_drelu, 1, k.numRelus, s);
    auto d_relu = gpuSelect<TIn, TOut, p, q>(peer, party, k.bout, k.selectKey, (u32 *)d_drelu, d_I, s);
    return d_relu;
}
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

1 participant