Monday, November 16, 2020

Parallel Computer Architecture: Efficient Micro Parallel Synchronization Mechanisms

I have often wondered why modern computer instruction set architectures do not have more efficient parallel synchronization mechanisms.  Current mainstream microprocessor designs currently support two types of parallelism.

  • Very fine grain
    • Hardware based implicit instruction level
    • Implemented via advanced pipeline register renaming.
    • Synchronization delays on the order of a single cycle.
  • Very course grain
    • Software based explicit thread synchronization primitives
    • Implemented via atomic memory instructions.
    • Synchronization delays on the order of tens of thousands of cycles or more.
With CPU clock frequencies beginning to plateau it may be time to revisit architectural synchronization models as a method to continue improving overall program performance.  If we have any bright PHD candidates reading this fishing for a dissertation topic, please consider this.

Parallel Architecture Models

At the process level we have the architectural notion of an interrupt.  But at the thread level this does not exist.  We have to rely on threads spinning in a loop reading and writing a shared memory location together with memory synchronization barriers and no architectural specification about how long this can take.  This is ridiculous.  We can't have efficient parallel programming if the programming model has no mechanism to facilitate it.  We need some data queue or message passing mechanism or interrupt that operates at the instruction architecture level if we are to enable efficient parallel programming.

Explicit Instruction Level Parallelism

I would like to see an efficient software visible instruction level synchronization mechanism.  For example, something like a 'Queue Register'.  Some existing IO registers track read and write state.  I'm thinking some general purpose registers could similarly be architected for managing data flow synchronization at the register data level.  Such registers could essentially stall the execution pipeline on reads until a write to that register has occurred.  So the register effectively acts as a 'data queue' at the instruction execution level.  This would enable software control of fine grain parallelism, opening up potentially more real parallelism than relying on hardware to extract parallelism from an inherently sequential programming model.

Since all compute state needs to be visible in order to stop, save, and later restart a process, status bits will also need to track the read/write data state of each queue register.  CPU pipelines could be redesigned to key off of these explicit reg data states, instead of implicit internal hardware states.  Just like current hardware threads swap in whichever thread has data ready, these new threads could work the same way.  The primary difference being the data ready state is now software architecturally visible.

Further note that these hardware queue registers are effectively thread state ready registers, analogous to ready state flags in operating system thread schedulers.  Since these ready flags are intended for micro data level parallelism, they should be closely aligned to the real register thread state supported by the hardware, as opposed to some arbitrary virtual state that relies on time slicing and swapping threads in and out of hardware.  While time slicing is theoretically possible it would blow up performance by 10000 times, entirely defeating the advantage of micro level parallelism.

So there is a different mind set when programming this level of parallelism.  This type of parallelism should have some awareness of the number of hardware threads efficiently supported by hardware, as opposed to some very course grain parallelism that has little concern about real hardware thread counts.  The implication is that this level of coding is more appropriate for hand coded assembly or for compilers.
 
References

https://riscv.org/community/directory-of-working-groups/

https://en.wikipedia.org/wiki/MIMD

https://en.wikipedia.org/wiki/Explicitly_parallel_instruction_computing

https://en.wikipedia.org/wiki/Parallel_programming_model

https://www.cs.utexas.edu/~trips/index.html

https://scholar.google.com/scholar?q=parallel+computer+architecture&hl=en&as_sdt=0&as_vis=1&oi=scholart

Politics: The Political Divide (Urban verses Rural)

The 2020 US presidential election is over and it looks like Joe Biden will be replacing Donald Trump as the next US president.  From what I've gathered from the talking heads on network TV and the internet there is a lot of angst about our deeply divided country.  Some even talk about doing away with the Electoral College.  

When I look at the electoral results map it is blindingly painfully obvious that conservative red districts are rural, and liberal blue districts are urban.  This makes perfect sense to me so I don't get why this is so hard for the major media talking heads to understand.  A rural farmer living on a 100 acre farm by absolute necessity has to be far more self sufficient and independent than a desk jockey living in a high rise condo in a large metropolis.  Duh.  This ain't rocket science. 

If you live on a rural farm, and someone is breaking into your house in the middle of the night, you don't hide in the closet and dial 911, you grab your gun and deal with it.  Waiting an hour for the sheriff to arrive is not an option, especially if you have family.  

When you're plowing your field and your tractor breaks down you get your toolbox and start diagnosing what is wrong.  Why ?  Because waiting a week for a repairmen is not an option for your crop schedule or your wallet.

Global warming ?  That is concerning, but more concerning right now for the working rural poor are their bleeding knuckles and what their family is going to eat tonight.

So can we please stop demonizing the working rural poor who voted for less federal bureaucracy and more job security in their lives ?  Donald Trump may be an amoral self serving narcissist, but that doesn't mean everything he says is wrong.  Let's not forget there is a reason he got elected for his first term.

And regarding the Electoral College, this is the mechanism that the framers of the constitution came up with to balance out the rural state needs with the urban population focused house of representatives.  Anyone who talks about scrapping the Electoral College without some other mechanism to represent the working rural poor is risking disenfranchising the working rural poor.  That is self serving, oppressive, and potentially grounds for civil war, so uh, probably not a good idea.

So please remember, we don't all live in high rise urban condos and have high paying jobs.

Monday, October 12, 2020

The McLaughlin Group

I miss John McLaughlin.

John McLaughlin brought together opinions from both the left and right in one show in an intelligent, informative, and entertaining fashion.  It seems every news show I watch now is hopelessly partisan and panders to one side or the other.  Listening to just one side of an issue not only impairs your judgement, it can harm your mental health and depress you.  It is literally how brain washing is done.

I notice that the show has recently rebooted on You tube with a new host.  

https://www.youtube.com/user/mclaughlingroup

This show has potential, but is not yet as good as the original.  Please keep bringing in new smart faces for both sides of current topics.  Hopefully some new leading personalities will develop.  

Make no mistake.  Both the left and right have have done plenty of evil before and will do so again if left unchecked.  If you don't present both sides of current issues, you are part of the problem, not the solution.  And if you're really cool (like John) you can even make it entertaining.

Tuesday, September 15, 2020

AI: Artificial Intelligence

A few thoughts on AI and the future

The Promise of AI
 
Make a list of the worst problems in the world.  Imagine what would happen if you brought some super intelligence to that problem.  It makes me think the future may really get better.  Fascinating.  For example:
  • Big Problems to solve
    • Poverty 
      • Poverty is a big hard problem that intersects human social behavior, population, and natural resources.  It is important to realize that poverty can never be solved 100 %.  Humans have free will.  The most that can be accomplished is to enable and encourage able and willing persons to help themselves.   Think along the lines of an available Personal Virtual Advisor for every person born.  Even though we can't save those who don't want help, getting good advice from a trusted personal advisor would be a dramatic improvement over the current situation in the world today.  Today countless children are born into homes with parents who are ill equipped to offer any sound advice about important life decisions.  A super smart personal advisor could make a giant difference in poverty and general quality of life for many currently disadvantaged persons.
    • Effective Government Policy
    • Diagnostic medicine
    • Others ?

Beyond solving problems a super intelligence could push forward new technologies

  • New technologies
    • Artificial human organs
      • Want to live to 200 years or more ?
    • Artificial super strength human limbs
      • Want to run 30 miles an hour ?
      • Want to pick up a 400 pound box ?
    • Computer to human brain interfaces
      • Just think 'hey Google' to access any information in the world.
    • Artificial super vision or hearing
      • Want a better look at that stranger 100 yards away ?
      • Want to hear that conversation 100 yards away ?
    • Artificial human wings
      • Please please please yes.
      • I really want to be able to fly like a bird with wings I can flap.
    • Fusion energy 
      • Once we have that that will solve many other resource problems !
    • Spaceship design and propulsion
    • Personalized education
    • Others ?
 
The Danger of AI 

As some blockbuster movies have shown and some public figures have agreed, the dangers of AI are real.  It is naive to think that we can contain an intelligence 1000 times smarter than any human.  Maybe when AIs are twice as smart as us they will still have empathy for us like we do for apes.  But when they get to be 1000 times as smart as us humans will be like insects to them.  Also be aware they will be able to learn in seconds what takes us years to learn via our biological brains.  So given sufficient memory and compute processors they could learn in minutes what mankind has taken thousands of years to learn.
  • AI is more dangerous than nuclear energy
    • As such we need to think very carefully about how to proceed, particularly as the computational power of new computers approaches the human brain.  Regulating the computational / memory capacity of new computers may in fact be the key to safe forward progress.  
  • Open Source AI
    • Given the importance and danger of AI, making the source code open is important.
      • https://openai.com/
    • It seems to me web browsers are pushing the envelope on AI technology.  Many people routinely type questions into Google now to get answers for all manner of questions.  It seems to me we need more / better open source web browsers.
      • https://gigablast.com/
Solution (My Opinion):

Here is my suggestion to solve this problem.
  1. Invest heavily in man machine neural interfaces
  2. Have government limit the computational power of any machine to something along the lines of what a human brain is until our neural interface technology allows humans to interface efficiently with computers and we can optionally evolve into machines rather than being taken over by them...


Sam Harris on AI


Elon Musk on AI



Sunday, September 13, 2020

I'm Retired

Effective August 28th 2020, I am officially retired from corporate life.  I worked for 35 plus years, mostly for various semiconductor companies in Austin Texas.  I split that time alternating between working on instruction set simulators, and core design verification, most recently at AMD.  While I'm grateful for the paycheck these last several years, I have to say I'm happy to have the politics of large corporate America now behind me.

Going forward I expect to spend my time doing three things:

  1. Rebuilding my retirement cabin.  This will be a near term focus as I don't have the energy I had when I was younger for such physical activity, so the sooner the better.  Also the sooner I get it done the sooner I can enjoy it. 
  2. Traveling.  After the pandemic is behind us, and the weather is pleasant (probably next spring) I plan to buy a new van and drive a big loop around the country.  I tend to get bored quickly when I travel but do enjoy some sightseeing particularly when I am doing the driving and can control the pace and schedule.  I've made a smaller loop to the West coast before in my current van and enjoyed it.  I've traveled some in the past, including internationally, but have yet to the see the northwest and northeast corners of the US.  So this seems like a good time to make that long drive.  Anybody have any suggestions ?  From a scenic point of view I especially like the Rocky mountains, but I have already seen them multiple times.  I've also seen the Grand Canyon.  I have yet to see Meteor Crater in Arizona, so that is on my list for this trip. 
  3. RISCV.  As I indicated in a previous post, I'm a fan of this architecture, both technically and politically.  I think this will do for computer architecture, what Linux did for Operating Systems.  So as a way of continuing to exercise my mind, and potentially supplement my retirement income, I hope to make a few contributions here to help push this technology forward...

Thursday, May 21, 2020

Some Pictures

Me: Getting better looking every day.

My awesome cabin where I recharge my batteries most weekends.


Craig helping with Doss Road patio project (2013)
Patio after


Guadalupe Mtns Tx, 2013
Colorado 2013
Colorado 2013

Sunday, October 20, 2019

Computer Architecture: Security Done Right

I don't get why it is so hard to build a secure computer.  I read so much about encryption technology and software being 'cracked' and companies spending millions of dollars patching their computer's security bugs.  Microsoft installs critical patches on my computer every few days and I cross my fingers every time that happens that I can boot my computer in the morning.  What the hell ?  It's not that hard to build a secure computer.  Here is how you do it.


  1. Secure the core
    • Use a Harvard computer architecture.  In other words build entirely separate logic pathways (including caches) for instructions and data.  This means that you can't have 'self modifying code' but so what ?  Less than 1% of the code in the world is really self modifying and that code is not really required and can be worked around in other ways with modest performance cost.  It is like trading turds for diamonds.  Easy decision.
    • A little more detail for clarity for CPU designers.  Yes I literally mean separate data paths and caches for instructions and data, all the way to the ALU instruction units.  No buses or caches should ever be shared, period.  Think entirely different systems.  This guarantees that no matter what magic software does it cannot modify the expected behavior of software instructions delivered to the CPU.  Period.  End of story.  Drop the mike.  Case closed.  No encryption coprocessor.  No decryption keys. No asterisk.  No buts.  The CPU is now naturally secure by design.  Trying to secure every line of software in a non Harvard architecture is like trying to stop rain one drop at a time.  Totally nuts. 
    • You can and should still have caches for performance, but since the caches aren't shared there is no concern for security.  There is no coherence or complexity issue either, since by definition the instructions and data are separate you don't have to worry about coherence between the instruction and data caches.
  2. Secure the box
    • All software should be delivered and run from 'ROM sticks' (ROM = Read Only Memory).  Imagine a small box with several USB like slots in it.  Each slot contains a stick from a trusted software vendor.  Installing new software from a trusted source literally means replacing the ROM stick in that slot in your computer.  Pulling the stick out of the slot 'uninstalls' it.  All software runs from ROM, not a hard drive.
    • Finally you should then only buy software ROM sticks from trusted software vendors.
Congratulations.  You now have a secure computer.  Go sell a million of these to the military and get rich.  You're welcome.

A couple more points for clarity and background.
  • The hard drive  
    • Once the CPU core and software ROM path is secured per above the hard drive becomes the next vulnerability point to secure.  This is because if software is allowed to write arbitrary information to your hard drive, this in an indirect way enables software the ability to behave in malicious unpredictable ways.  This is similar to the self modifying code problem in the CPU, but is at a higher level - the file IO level.  You should only buy software from trusted software vendors who certify that their software does not store any 'cookies' or such on your hard drive to effect software behavior.
    • The good news is that if the CPU and box are secured per steps 1 and 2 above the options for malicious actors to do malicious things to your computer are limited to them finding bizarre behavior effects for unusual data.  Even then since they can't execute code on your computer their hands are indeed very very tied.  Cool.

  • JavaScript is evil  

    • JavaScript by design is intended to be downloaded per website and executed on the users local machine.  Isn't that like parking an RV in a crime ridden neighborhood in the middle of the night, opening the front door and putting a neon Welcome sign above the door, and then acting surprised when a stranger comes in and misbehaves.  Sheesh. 
    • For this and several other technical reasons let me suggest RISCV discussed in a previous post for those looking for an open universal machine language, as an alternative to Java.

Further Info: