You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/03 02:41:00 UTC

[GitHub] [incubator-tvm] simplelins opened a new issue #6389: Performance step about memory reduced for sgx

simplelins opened a new issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389


   Hi,
       we do a performance test in a sgx env by reduce the usable memory ,in other way first we malloc memory from 75m-95m,and then run sgx demo to get the api's latency(fused_nn_contrib_conv2d_NCHWc_add_nn_relu) ,now we show some details as below:
   uname -a
   Linux  5.3.0-62-generic #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
   base of source :
   git log :commit 679fd29a7f6cae17d8c8b1b734a0abb0592ab3a8 (HEAD -> Nick_Hynes_SGX)
   the nets we used that only one layer, code as below : 
   `def one_layer(batch_size,
               num_classes=10,
               image_shape=(1, 28, 28),
               dtype="float32", alpha=1.0, layout='NCHW'):
       body = relay.var("data",
                        shape=image_shape,
                        dtype=dtype)
       body = conv_block(body, 'conv_block_1', channels=int(32*alpha), strides=(2, 2),
                         layout=layout)
       return relay.Function(relay.analysis.free_vars(body), body)
   
   def conv_block(data, name, channels, kernel_size=(3, 3), strides=(1, 1),
                  padding=(1, 1), epsilon=1e-5, layout='NCHW'):
       """Helper function to construct conv_bn-relu"""
       # convolution + bn + relu
       conv = layers.conv2d(
           data=data,
           channels=channels,
           kernel_size=kernel_size,
           strides=strides,
           padding=padding,
           name=name+'_conv')
       bn = layers.batch_norm_infer(data=conv, epsilon=epsilon, name=name + '_bn')
       act = relay.nn.relu(data=bn)
       return act
   `
   malloc memory by new a vector,befor run sgx demo , 
   'let mut data = (0..num * 1024 * 1024 / 4)
               .map(|y| y as u32)
               .collect::<Vec<u32>>();' 
   after sgx demo successfully, 
      'for d in &mut data {
               *d += 2;
       }'
   we get some datas as below:
   ![image](https://user-images.githubusercontent.com/53635925/92063900-da50dd80-edce-11ea-9211-18c69f8d4586.png)
   ![image](https://user-images.githubusercontent.com/53635925/92064035-387dc080-edcf-11ea-8a4e-fb4f766bdd6c.png)
   **we can find that the latency from 83m to 85m Dramatic increase.**
   graph.json as below,we only add a prefix for model.o's api.:
   ![image](https://user-images.githubusercontent.com/53635925/92065151-ad51fa00-edd1-11ea-8bb0-c76a436d093b.png)
   
   and more, we do a test for a normal app that only do a simple dh  algorithm, show as below:
   ![image](https://user-images.githubusercontent.com/53635925/92064847-fa819c00-edd0-11ea-964a-3fe4f01c6d47.png)
   
   In summary, we guess if there is a bug about tvm,please check!
   if neccessry,i can upload all the test codes


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] simplelins commented on issue #6389: Performance step about memory reduced for sgx

Posted by GitBox <gi...@apache.org>.
simplelins commented on issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389#issuecomment-687701227


   yeah,thanks for your reply.
                  i only  run this benchmark to know which issues will be impact the  performance, and found this. what is my question is that for a simple  sgx-demo about dh algrithm,I do a same operator ,but can not find this  dramatic increase.i am confused. source code at:[](https://github.com/simplelins/sgx-memory-test) . could you give more suggestion?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] simplelins edited a comment on issue #6389: Performance step about memory reduced for sgx

Posted by GitBox <gi...@apache.org>.
simplelins edited a comment on issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389#issuecomment-687701227


   yeah,thanks for your reply.
                  i only  run this benchmark to know which issues will be impact the  performance, and found this. what is my question is that for a simple  sgx-demo about dh algrithm,I do a same operator ,but can not find this  dramatic increase.i am confused. source code at:[sgx-memory-test](https://github.com/simplelins/sgx-memory-test) . could you give more suggestion?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] nhynes commented on issue #6389: Performance step about memory reduced for sgx

Posted by GitBox <gi...@apache.org>.
nhynes commented on issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389#issuecomment-686658268


   Nice benchmarks. The latency you're seeing is almost surely due to paging. My guess is that about 12 M are being used for your NN and other housekeeping structures. SGXv1 EPC only has 96 M usable EPC beyond which you're going to start swapping, which is slow.
   
   What's your actual use case? I'm sure there's a way to chop up your data for the algorithm you're using.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] simplelins edited a comment on issue #6389: Performance step about memory reduced for sgx

Posted by GitBox <gi...@apache.org>.
simplelins edited a comment on issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389#issuecomment-687701227


   yeah,thanks for your reply.
                  i only  run this benchmark to know which issues will be impact the  performance, and found this. what is my question is that for a simple  sgx-demo about dh algrithm,I do a same operator ,but can not find this  dramatic increase.i am confused. source code at:[sgx-memory-test](https://github.com/simplelins/sgx-memory-test) . could you give more suggestion?
   @nhynes 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] tqchen commented on issue #6389: Performance step about memory reduced for sgx

Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #6389:
URL: https://github.com/apache/incubator-tvm/issues/6389#issuecomment-686614498


   cc @nhynes @jroesch 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org